create missing id_prim

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
feature/573/request-on-host-meta
Maxence Lange 2019-05-08 09:02:00 -01:00
rodzic 7deb98642a
commit 4ab6b9cf6e
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -1189,8 +1189,15 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
$insert->insert($table);
foreach ($fields as $field) {
$value = $this->get($field, $data, '');
if ($field === 'id_prim'
&& $value === ''
&& $this->get('id', $data, '') !== '') {
$value = hash('sha512', $this->get('id', $data, ''));
}
$insert->setValue(
$field, $insert->createNamedParameter($this->get($field, $data, ''))
$field, $insert->createNamedParameter($value)
);
}