@@ -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 |
@@ -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->getCollate() == '' ? '' : sprintf("COLLATE '%s'", $this->getCollate()); |
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 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $collate = $this->getCollate() == '' ? '' : sprintf("COLLATE '%s'", $this->getCollate()); |
199 | 199 | $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); |
200 | 200 | |
201 | - return [str_replace([' ', ' ',], ' ', $modification)]; |
|
201 | + return [str_replace([' ', ' ', ], ' ', $modification)]; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | public function deleteStatement() |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $tables = $database->getTables(); |
44 | 44 | $newTables = $newDatabase->getTables(); |
45 | 45 | |
46 | - if($this->checkCollate && $database->getCollate() != $newDatabase->getCollate()){ |
|
46 | + if ($this->checkCollate && $database->getCollate() != $newDatabase->getCollate()) { |
|
47 | 47 | $database->setCollate($newDatabase->getCollate()); |
48 | 48 | $modificationsBetweenTable[] = $database->alterStatement(); |
49 | 49 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | { |
249 | 249 | $statements = []; |
250 | 250 | foreach ($modificationsBetweenTable as $modifications) { |
251 | - foreach ((array)$modifications as $modification) { |
|
251 | + foreach ((array) $modifications as $modification) { |
|
252 | 252 | $statements[] = $modification; |
253 | 253 | } |
254 | 254 | } |
@@ -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; |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | |
140 | 140 | foreach ($data as $nomTable => $table) { |
141 | 141 | $dataTable = $resolverTable->resolve($table); |
142 | - foreach ((array)$dataTable['columns'] as $columnName => $column) { |
|
142 | + foreach ((array) $dataTable['columns'] as $columnName => $column) { |
|
143 | 143 | $dataTable['columns'][$columnName] = $resolverColumns->resolve($column); |
144 | 144 | } |
145 | 145 | foreach (['indexes', 'uniques'] as $indexKey) { |
146 | - foreach ((array)$dataTable[$indexKey] as $keyIndex => $index) { |
|
146 | + foreach ((array) $dataTable[$indexKey] as $keyIndex => $index) { |
|
147 | 147 | $dataTable[$indexKey][$keyIndex] = $resolverIndex->resolve($index); |
148 | 148 | } |
149 | 149 | } |