small fix in migration

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/762/head
Maxence Lange 2019-09-28 15:05:34 +02:00
rodzic b006c2ffbc
commit 231590a415
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -289,7 +289,7 @@ class Version0002Date20190916000001 extends SimpleMigrationStep {
} }
$qb = $this->connection->getQueryBuilder(); $qb = $this->connection->getQueryBuilder();
$qb->select('id_prim', 'object_id', 'attributed_to', 'object_id_prim') $qb->select('id_prim', 'object_id', 'attributed_to', 'attributed_to_prim')
->from('social_a2_stream'); ->from('social_a2_stream');
$cursor = $qb->execute(); $cursor = $qb->execute();
@ -305,13 +305,15 @@ class Version0002Date20190916000001 extends SimpleMigrationStep {
* @param array $data * @param array $data
*/ */
private function updateStreamPrim(array $data) { private function updateStreamPrim(array $data) {
if ($data['object_id_prim'] !== '') { if ($data['attributed_to_prim'] !== '') {
return; return;
} }
$update = $this->connection->getQueryBuilder(); $update = $this->connection->getQueryBuilder();
$update->update('social_a2_stream'); $update->update('social_a2_stream');
$update->set('object_id_prim', $update->createNamedParameter(hash('sha512', $data['object_id']))); if ($data['object_id'] !== '') {
$update->set('object_id_prim', $update->createNamedParameter(hash('sha512', $data['object_id'])));
}
$update->set( $update->set(
'attributed_to_prim', $update->createNamedParameter(hash('sha512', $data['attributed_to'])) 'attributed_to_prim', $update->createNamedParameter(hash('sha512', $data['attributed_to']))
); );