@@ -188,7 +188,7 @@ |
||
| 188 | 188 | { |
| 189 | 189 | $statements = []; |
| 190 | 190 | foreach ($modificationsBetweenTable as $modifications) { |
| 191 | - foreach ((array)$modifications as $modification) { |
|
| 191 | + foreach ((array) $modifications as $modification) { |
|
| 192 | 192 | $statements[] = $modification; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public function getTablesCollation($database, $table) |
| 55 | 55 | { |
| 56 | - $sql =' SELECT c.collation_name |
|
| 56 | + $sql = ' SELECT c.collation_name |
|
| 57 | 57 | FROM information_schema.`TABLES` t |
| 58 | 58 | INNER JOIN information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` c ON c.collation_name = t.table_collation |
| 59 | 59 | WHERE |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $isEnum = explode('enum', $this->type); |
| 76 | 76 | if (!empty($isEnum)) { |
| 77 | - $numberElements = substr_count(str_replace(['(', ')', "'",], '', $isEnum[1]), ',') + 1; |
|
| 77 | + $numberElements = substr_count(str_replace(['(', ')', "'", ], '', $isEnum[1]), ',') + 1; |
|
| 78 | 78 | if ($numberElements == 2) { |
| 79 | 79 | $this->type = 'tinyint'; |
| 80 | 80 | $this->length = 1; |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | $null = $this->getNullable() ? '' : 'NOT'; |
| 117 | 117 | $default = $this->getDefaultValue() == false ? '' : ' DEFAULT ' . $this->getDefaultValue(); |
| 118 | - $collate = $this->getCollate()==''?'':sprintf("COLLATE '%s'", $this->getCollate()); |
|
| 118 | + $collate = $this->getCollate() == '' ? '' : sprintf("COLLATE '%s'", $this->getCollate()); |
|
| 119 | 119 | $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); |
| 120 | 120 | |
| 121 | - return [str_replace([' ', ' ',], ' ', $modification)]; |
|
| 121 | + return [str_replace([' ', ' ', ], ' ', $modification)]; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -189,9 +189,9 @@ discard block |
||
| 189 | 189 | $null = $this->getNullable() ? '' : 'NOT'; |
| 190 | 190 | $default = $this->getDefaultValue() == false ? '' : ' DEFAULT ' . $this->getDefaultValue(); |
| 191 | 191 | $columnName = '`' . $this->getName() . '`'; |
| 192 | - $collate = $this->getCollate()==''?'':sprintf("COLLATE '%s'", $this->getCollate()); |
|
| 192 | + $collate = $this->getCollate() == '' ? '' : sprintf("COLLATE '%s'", $this->getCollate()); |
|
| 193 | 193 | $modification = sprintf('ALTER TABLE `%s` CHANGE COLUMN %s %s %s %s NULL %s %s %s;', $this->getTable(), $columnName, $columnName, $this->getColonneType(), $null, $default, $this->getExtra(), $collate); |
| 194 | 194 | |
| 195 | - return [str_replace([' ', ' ',], ' ', $modification)]; |
|
| 195 | + return [str_replace([' ', ' ', ], ' ', $modification)]; |
|
| 196 | 196 | } |
| 197 | 197 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | foreach ($columns as $column) { |
| 175 | 175 | try { |
| 176 | - if($this->getCollate() == ''){ |
|
| 176 | + if ($this->getCollate() == '') { |
|
| 177 | 177 | $column->setCollate(''); |
| 178 | 178 | } |
| 179 | 179 | $modifications[] = $column->createStatement(); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | { |
| 208 | 208 | $statements = []; |
| 209 | 209 | foreach ($modificationsBetweenTable as $modifications) { |
| 210 | - foreach ((array)$modifications as $modification) { |
|
| 210 | + foreach ((array) $modifications as $modification) { |
|
| 211 | 211 | $statements[] = $modification; |
| 212 | 212 | } |
| 213 | 213 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | $tmp = []; |
| 224 | 224 | foreach ($modifications as $modification) { |
| 225 | - $tmp[] = trim(str_replace(['ALTER TABLE `' . $this->getTable() . '` ADD COLUMN', 'ALTER TABLE `' . $this->getTable() . '` ADD ', ';',], '', $modification)); |
|
| 225 | + $tmp[] = trim(str_replace(['ALTER TABLE `' . $this->getTable() . '` ADD COLUMN', 'ALTER TABLE `' . $this->getTable() . '` ADD ', ';', ], '', $modification)); |
|
| 226 | 226 | } |
| 227 | 227 | $collate = $this->getCollate() == '' ? '' : sprintf("COLLATE='%s'", $this->getCollate()); |
| 228 | 228 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | if (isset($row['collate'])) { |
| 55 | 55 | $table->setCollate($dataTable['collate']); |
| 56 | 56 | } |
| 57 | - foreach ((array)$dataTable['columns'] as $columnName => $row) { |
|
| 57 | + foreach ((array) $dataTable['columns'] as $columnName => $row) { |
|
| 58 | 58 | $column = new MysqlDatabaseColumn($columnName, $row['type'], $row['length'], $row['nullable'], $row['defaultValue'], $row['extra']); |
| 59 | 59 | if (isset($row['collate'])) { |
| 60 | 60 | $column->setCollate($row['collate']); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | $table->addColumn($column); |
| 63 | 63 | |
| 64 | 64 | } |
| 65 | - foreach ((array)$dataTable['indexes'] as $row) { |
|
| 65 | + foreach ((array) $dataTable['indexes'] as $row) { |
|
| 66 | 66 | $table->addIndex($row['columns'], $row['name']); |
| 67 | 67 | } |
| 68 | 68 | if (isset($dataTable['primary'])) { |
| 69 | - $table->addPrimary((array)$dataTable['primary']); |
|
| 69 | + $table->addPrimary((array) $dataTable['primary']); |
|
| 70 | 70 | } |
| 71 | - foreach ((array)$dataTable['uniques'] as $row) { |
|
| 71 | + foreach ((array) $dataTable['uniques'] as $row) { |
|
| 72 | 72 | $table->addUnique($row['columns'], $row['name']); |
| 73 | 73 | } |
| 74 | 74 | $tables[] = $table; |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | $export = []; |
| 129 | 129 | foreach ($data as $nomTable => $table) { |
| 130 | 130 | $dataTable = $resolverTable->resolve($table); |
| 131 | - foreach ((array)$dataTable['columns'] as $columnName => $column) { |
|
| 131 | + foreach ((array) $dataTable['columns'] as $columnName => $column) { |
|
| 132 | 132 | $dataTable['columns'][$columnName] = $resolverColumns->resolve($column); |
| 133 | 133 | } |
| 134 | 134 | foreach (['indexes', 'uniques'] as $indexKey) { |
| 135 | - foreach ((array)$dataTable[$indexKey] as $keyIndex => $index) { |
|
| 135 | + foreach ((array) $dataTable[$indexKey] as $keyIndex => $index) { |
|
| 136 | 136 | $dataTable[$indexKey][$keyIndex] = $resolverIndex->resolve($index); |
| 137 | 137 | } |
| 138 | 138 | } |