@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $this->updateTable($table); |
| 43 | 43 | |
| 44 | - if (!$metadata->generateSnapshot()) return; |
|
| 44 | + if (!$metadata->generateSnapshot()) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $table = $this->generateTable($metadata, true); |
| 47 | 49 | $table->setPrimaryKey([$this->idColumnName, $metadata->getSnapshotColumnName()]); |
@@ -64,7 +66,9 @@ discard block |
||
| 64 | 66 | |
| 65 | 67 | return new Table($name, |
| 66 | 68 | array_merge($predefinedColumns, array_map(function(ReadModelField $field) use (&$indices) { |
| 67 | - if ($field->useIndex()) $indices[] = new Index(sprintf('IDX_%s', $field->getId()), [$field->getId()]); |
|
| 69 | + if ($field->useIndex()) { |
|
| 70 | + $indices[] = new Index(sprintf('IDX_%s', $field->getId()), [$field->getId()]); |
|
| 71 | + } |
|
| 68 | 72 | |
| 69 | 73 | return $this->columnFactory->createColumn($field->getDataType(), $field->getId()); |
| 70 | 74 | }, $metadata->getFields())), |
@@ -79,13 +83,15 @@ discard block |
||
| 79 | 83 | function(Table $existingTable) use ($table) { return $table->getName() == $existingTable->getName(); } |
| 80 | 84 | ); |
| 81 | 85 | |
| 82 | - if (count($existingTables) > 1) |
|
| 83 | - throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName())); |
|
| 86 | + if (count($existingTables) > 1) { |
|
| 87 | + throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName())); |
|
| 88 | + } |
|
| 84 | 89 | |
| 85 | 90 | if (count($existingTables) == 1) { |
| 86 | 91 | $tableDiff = $this->schemaComparator->diffTable(current($existingTables), $table); |
| 87 | - if ($tableDiff) |
|
| 88 | - $this->schemaManager->alterTable($tableDiff); |
|
| 92 | + if ($tableDiff) { |
|
| 93 | + $this->schemaManager->alterTable($tableDiff); |
|
| 94 | + } |
|
| 89 | 95 | } else { |
| 90 | 96 | $this->schemaManager->createTable($table); |
| 91 | 97 | } |