@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function getTableName($table) |
45 | 45 | { |
46 | - return '{{%' . str_replace($this->db->tablePrefix, '', $table->name) . '}}'; |
|
46 | + return '{{%'.str_replace($this->db->tablePrefix, '', $table->name).'}}'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | |
54 | 54 | |
55 | - return '$this->batchInsert("{{%test}}", ' . $rows . ', ' . $columns . ');'; |
|
55 | + return '$this->batchInsert("{{%test}}", '.$rows.', '.$columns.');'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | foreach ($data as $row) { |
77 | 77 | $rows = ''; |
78 | 78 | foreach ($row as $value) { |
79 | - $rows .= "'" . addslashes($value) . "',"; |
|
79 | + $rows .= "'".addslashes($value)."',"; |
|
80 | 80 | } |
81 | - self::$rows .= "\n\t\t\t" . self::dataFormat($rows) . ","; |
|
81 | + self::$rows .= "\n\t\t\t".self::dataFormat($rows).","; |
|
82 | 82 | } |
83 | 83 | if (!empty(self::$rows)) { |
84 | 84 | return self::dataFormat(self::$rows); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if (null !== $trim) { |
97 | 97 | $data = rtrim($data, $trim); |
98 | 98 | } |
99 | - return self::$dataEncloser[0] . $data . self::$dataEncloser[1]; |
|
99 | + return self::$dataEncloser[0].$data.self::$dataEncloser[1]; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $data = rtrim($data, $trim); |
111 | 111 | } |
112 | 112 | |
113 | - return self::$columnEncloser[0] . rtrim($data, $trim) . self::$columnEncloser[1]; |
|
113 | + return self::$columnEncloser[0].rtrim($data, $trim).self::$columnEncloser[1]; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | throw new Exception("The 'db' option must refer to the application component ID of a DB connection."); |
90 | 90 | } |
91 | 91 | |
92 | - $path = (string)Yii::getAlias($this->migrationPath); |
|
92 | + $path = (string) Yii::getAlias($this->migrationPath); |
|
93 | 93 | |
94 | 94 | |
95 | 95 | if (!is_dir($path)) { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function getCreateTableSql($table) |
186 | 186 | { |
187 | - $row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteTableName($table->fullName))->queryOne(); |
|
187 | + $row = $this->db->createCommand('SHOW CREATE TABLE '.$this->quoteTableName($table->fullName))->queryOne(); |
|
188 | 188 | if (isset($row['Create Table'])) { |
189 | 189 | $sql = $row['Create Table']; |
190 | 190 | } else { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function actionUpData($limit = 0) |
209 | 209 | { |
210 | - $this->migrationPath .= DIRECTORY_SEPARATOR . $this->dataMigrationFolder; |
|
210 | + $this->migrationPath .= DIRECTORY_SEPARATOR.$this->dataMigrationFolder; |
|
211 | 211 | return parent::actionUp($limit); |
212 | 212 | } |
213 | 213 | |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | public function actionTable(array $tables) |
223 | 223 | { |
224 | 224 | |
225 | - if ($this->confirm('Create the migration ' . "?")) { |
|
225 | + if ($this->confirm('Create the migration '."?")) { |
|
226 | 226 | |
227 | 227 | foreach ($tables as $key => $tableName) { |
228 | 228 | |
229 | - $this->class = 'create_table_' . $tableName; |
|
229 | + $this->class = 'create_table_'.$tableName; |
|
230 | 230 | |
231 | 231 | try { |
232 | 232 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $this->table = $this->getTableName($table); |
252 | 252 | |
253 | 253 | foreach ($table->columns as $col) { |
254 | - $up .= "\t\t\t" . '\'' . $col->name . '\'=>"' . $this->getColType($col) . '",' . "\n"; |
|
254 | + $up .= "\t\t\t".'\''.$col->name.'\'=>"'.$this->getColType($col).'",'."\n"; |
|
255 | 255 | if ($col->isPrimaryKey) { |
256 | 256 | // Add column to composite primary key array |
257 | 257 | $compositePrimaryKeyCols[] = $col->name; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | $ukeys = $this->db->schema->findUniqueIndexes($table); |
262 | 262 | if (!empty($ukeys)) { |
263 | - $indexArr =[]; |
|
263 | + $indexArr = []; |
|
264 | 264 | foreach ($ukeys as $key => $value) { |
265 | 265 | $indexKey = $key; |
266 | 266 | foreach ($value as $id => $field) { |
@@ -268,15 +268,15 @@ discard block |
||
268 | 268 | } |
269 | 269 | } |
270 | 270 | $indexStr = implode(',', $indexArr); |
271 | - $up .= "\t\t" . '$this->createIndex(\'idx_' . $indexKey . "', '" . $this->getTableName($table) . "', '$indexStr', TRUE);\n"; |
|
271 | + $up .= "\t\t".'$this->createIndex(\'idx_'.$indexKey."', '".$this->getTableName($table)."', '$indexStr', TRUE);\n"; |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
275 | 275 | if (!empty($table->foreignKeys)): |
276 | 276 | |
277 | 277 | foreach ($table->foreignKeys as $fkName => $fk) { |
278 | - $addForeignKeys .= "\t\t" . '$this->addForeignKey("' . $fkName . '", "' . $table->name . '", "' . $fk['column'] . '","' . $fk['table'] . '","' . $fk['ref_column'] . '", "' . $fk['delete'] . '", "' . $fk['update'] . '");' . "\n"; |
|
279 | - $dropForeignKeys .= '$this->dropForeignKey(' . "'$fkName', '$table->name');"; |
|
278 | + $addForeignKeys .= "\t\t".'$this->addForeignKey("'.$fkName.'", "'.$table->name.'", "'.$fk['column'].'","'.$fk['table'].'","'.$fk['ref_column'].'", "'.$fk['delete'].'", "'.$fk['update'].'");'."\n"; |
|
279 | + $dropForeignKeys .= '$this->dropForeignKey('."'$fkName', '$table->name');"; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | endif; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | $fields = $this->parseFields(); |
287 | 287 | |
288 | - $this->prepareFile(['up' => '', 'down' => '', 'foreignKeys' => $table->foreignKeys, 'fields' => $fields]) . "\n\n"; |
|
288 | + $this->prepareFile(['up' => '', 'down' => '', 'foreignKeys' => $table->foreignKeys, 'fields' => $fields])."\n\n"; |
|
289 | 289 | |
290 | 290 | } |
291 | 291 | |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | public function actionData(array $tables) |
302 | 302 | { |
303 | 303 | |
304 | - if ($this->confirm('Create the migration ' . "?", true)) { |
|
304 | + if ($this->confirm('Create the migration '."?", true)) { |
|
305 | 305 | foreach ($tables as $key => $args) { |
306 | 306 | |
307 | 307 | $table = $args; |
308 | - $this->class = 'insert_data_into_' . $table; |
|
308 | + $this->class = 'insert_data_into_'.$table; |
|
309 | 309 | $this->table = $table; |
310 | 310 | $this->templateFile = '@tmukherjee13/migration/views/dataTemplate.php'; |
311 | 311 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $pcolumns = ''; |
335 | 335 | foreach ($columns->columns as $column) { |
336 | - $pcolumns .= "'" . $column->name . "',"; |
|
336 | + $pcolumns .= "'".$column->name."',"; |
|
337 | 337 | } |
338 | 338 | foreach ($data as $row) { |
339 | 339 | array_push($prepared_data, $row); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | { |
364 | 364 | |
365 | 365 | $schema = $args; |
366 | - $this->class = 'dump_database_' . $schema; |
|
366 | + $this->class = 'dump_database_'.$schema; |
|
367 | 367 | |
368 | 368 | // $tables = $this->db->schema->getTableNames($schema); |
369 | 369 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $generateTables = []; |
379 | 379 | |
380 | 380 | foreach ($tables as $table) { |
381 | - if ($table->name === $this->db->tablePrefix . $this->migrationTable) { |
|
381 | + if ($table->name === $this->db->tablePrefix.$this->migrationTable) { |
|
382 | 382 | continue; |
383 | 383 | } |
384 | 384 | $generateTables[] = $table->name; |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | public function getFileName() |
392 | 392 | { |
393 | - return 'm' . gmdate('ymd_His') . '_' . $this->class; |
|
393 | + return 'm'.gmdate('ymd_His').'_'.$this->class; |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | public function setFileName() |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | public function prepareFile($data) |
402 | 402 | { |
403 | 403 | if ($this->useDataMigrationFolder) { |
404 | - FileHelper::createDirectory($this->migrationPath . DIRECTORY_SEPARATOR . $this->dataMigrationFolder); |
|
404 | + FileHelper::createDirectory($this->migrationPath.DIRECTORY_SEPARATOR.$this->dataMigrationFolder); |
|
405 | 405 | } |
406 | - $file = $this->migrationPath . DIRECTORY_SEPARATOR . ($this->useDataMigrationFolder ? $this->dataMigrationFolder . DIRECTORY_SEPARATOR : null) . $this->getFileName() . '.php'; |
|
406 | + $file = $this->migrationPath.DIRECTORY_SEPARATOR.($this->useDataMigrationFolder ? $this->dataMigrationFolder.DIRECTORY_SEPARATOR : null).$this->getFileName().'.php'; |
|
407 | 407 | try { |
408 | 408 | |
409 | 409 | $data['table'] = $this->table; |