@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | $statements = []; |
| 196 | 196 | foreach ($modificationsBetweenTable as $modifications) { |
| 197 | - foreach ((array)$modifications as $modification) { |
|
| 197 | + foreach ((array) $modifications as $modification) { |
|
| 198 | 198 | $statements[] = $modification; |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | $tmp = []; |
| 211 | 211 | foreach ($modifications as $modification) { |
| 212 | - $tmp[] = trim(str_replace(['ALTER TABLE `' . $this->getTable() . '` ADD COLUMN', 'ALTER TABLE `' . $this->getTable() . '` ADD ', ';',], '', $modification)); |
|
| 212 | + $tmp[] = trim(str_replace(['ALTER TABLE `' . $this->getTable() . '` ADD COLUMN', 'ALTER TABLE `' . $this->getTable() . '` ADD ', ';', ], '', $modification)); |
|
| 213 | 213 | } |
| 214 | 214 | $collate = $this->getCollate() == '' ? '' : sprintf("COLLATE='%s'", $this->getCollate()); |
| 215 | 215 | |
@@ -115,14 +115,14 @@ |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | - public function exportStructure(){ |
|
| 119 | - $export = []; |
|
| 118 | + public function exportStructure(){ |
|
| 119 | + $export = []; |
|
| 120 | 120 | $tables = $this->repositoryMysql->getTablesStructure($this->databaseName); |
| 121 | 121 | foreach ($tables as $table) { |
| 122 | 122 | $export[$table] = $this->getIndex($table); |
| 123 | 123 | $export[$table]['columns'] = $this->getColumns($table); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return json_encode($export); |
|
| 127 | - } |
|
| 126 | + return json_encode($export); |
|
| 127 | + } |
|
| 128 | 128 | } |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | - public function exportStructure(){ |
|
| 118 | + public function exportStructure() { |
|
| 119 | 119 | $export = []; |
| 120 | 120 | $tables = $this->repositoryMysql->getTablesStructure($this->databaseName); |
| 121 | 121 | foreach ($tables as $table) { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | if (isset($dataTable['collate'])) { |
| 59 | 59 | $table->setCollate($dataTable['collate']); |
| 60 | 60 | } |
| 61 | - foreach ((array)$dataTable['columns'] as $columnName => $row) { |
|
| 61 | + foreach ((array) $dataTable['columns'] as $columnName => $row) { |
|
| 62 | 62 | $column = new MysqlDatabaseColumn($columnName, $row['type'], $row['length'], $row['nullable'], $row['defaultValue'], $row['extra']); |
| 63 | 63 | if (isset($row['collate']) || $table->getCollate()) { |
| 64 | 64 | $column->setCollate($row['collate']); |
@@ -66,20 +66,20 @@ discard block |
||
| 66 | 66 | $table->addColumn($column); |
| 67 | 67 | |
| 68 | 68 | } |
| 69 | - foreach ((array)$dataTable['indexes'] as $row) { |
|
| 69 | + foreach ((array) $dataTable['indexes'] as $row) { |
|
| 70 | 70 | $table->addIndex($row['columns'], $row['name']); |
| 71 | 71 | } |
| 72 | 72 | if (isset($dataTable['primary'])) { |
| 73 | - $table->addPrimary((array)$dataTable['primary']); |
|
| 73 | + $table->addPrimary((array) $dataTable['primary']); |
|
| 74 | 74 | } |
| 75 | - foreach ((array)$dataTable['uniques'] as $row) { |
|
| 75 | + foreach ((array) $dataTable['uniques'] as $row) { |
|
| 76 | 76 | $table->addUnique($row['columns'], $row['name']); |
| 77 | 77 | } |
| 78 | 78 | $tables[] = $table; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $mysqlDatabase = new MysqlDatabase($databaseName); |
| 82 | - foreach($tables as $table){ |
|
| 82 | + foreach ($tables as $table) { |
|
| 83 | 83 | $mysqlDatabase->addTable($table); |
| 84 | 84 | } |
| 85 | 85 | return $mysqlDatabase; |
@@ -136,17 +136,17 @@ discard block |
||
| 136 | 136 | ); |
| 137 | 137 | $export = []; |
| 138 | 138 | $data = $data['tables']; |
| 139 | - if(empty($data['tables'])){ |
|
| 139 | + if (empty($data['tables'])) { |
|
| 140 | 140 | return []; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | foreach ($data as $nomTable => $table) { |
| 144 | 144 | $dataTable = $resolverTable->resolve($table); |
| 145 | - foreach ((array)$dataTable['columns'] as $columnName => $column) { |
|
| 145 | + foreach ((array) $dataTable['columns'] as $columnName => $column) { |
|
| 146 | 146 | $dataTable['columns'][$columnName] = $resolverColumns->resolve($column); |
| 147 | 147 | } |
| 148 | 148 | foreach (['indexes', 'uniques'] as $indexKey) { |
| 149 | - foreach ((array)$dataTable[$indexKey] as $keyIndex => $index) { |
|
| 149 | + foreach ((array) $dataTable[$indexKey] as $keyIndex => $index) { |
|
| 150 | 150 | $dataTable[$indexKey][$keyIndex] = $resolverIndex->resolve($index); |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $isEnum = explode('enum', $this->type); |
| 65 | 65 | if (!empty($isEnum)) { |
| 66 | - $numberElements = substr_count(str_replace(['(', ')', "'",], '', $isEnum[1]), ',') + 1; |
|
| 66 | + $numberElements = substr_count(str_replace(['(', ')', "'", ], '', $isEnum[1]), ',') + 1; |
|
| 67 | 67 | if ($numberElements == 2) { |
| 68 | 68 | $this->type = 'tinyint'; |
| 69 | 69 | $this->length = 1; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $collate = $this->formatCollate(); |
| 93 | 93 | $modification = sprintf('ALTER TABLE `%s` ADD COLUMN `%s` %s %s NULL %s %s %s;', $this->getTable(), $this->getName(), $this->getColonneType(), $null, $default, $this->getExtra(), $collate); |
| 94 | 94 | |
| 95 | - return [str_replace([' ', ' ',], ' ', $modification)]; |
|
| 95 | + return [str_replace([' ', ' ', ], ' ', $modification)]; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $collate = $this->formatCollate(); |
| 206 | 206 | $modification = sprintf('ALTER TABLE `%s` CHANGE COLUMN `%s` `%s` %s %s NULL %s %s %s;', $this->getTable(), $this->getName(), $this->getName(), $this->getColonneType(), $null, $default, $this->getExtra(), $collate); |
| 207 | 207 | |
| 208 | - return [str_replace([' ', ' ',], ' ', $modification)]; |
|
| 208 | + return [str_replace([' ', ' ', ], ' ', $modification)]; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | public function deleteStatement(): string |