@@ -544,16 +544,16 @@ |
||
| 544 | 544 | $updatedAt = $updatedAt === null ? 'updated_at' : $updatedAt; |
| 545 | 545 | |
| 546 | 546 | $this->addColumn($createdAt, 'timestamp', [ |
| 547 | - 'default' => 'CURRENT_TIMESTAMP', |
|
| 548 | - 'update' => '', |
|
| 549 | - 'timezone' => $withTimezone, |
|
| 550 | - ]) |
|
| 551 | - ->addColumn($updatedAt, 'timestamp', [ |
|
| 552 | - 'null' => true, |
|
| 553 | - 'default' => null, |
|
| 554 | - 'update' => 'CURRENT_TIMESTAMP', |
|
| 555 | - 'timezone' => $withTimezone, |
|
| 556 | - ]); |
|
| 547 | + 'default' => 'CURRENT_TIMESTAMP', |
|
| 548 | + 'update' => '', |
|
| 549 | + 'timezone' => $withTimezone, |
|
| 550 | + ]) |
|
| 551 | + ->addColumn($updatedAt, 'timestamp', [ |
|
| 552 | + 'null' => true, |
|
| 553 | + 'default' => null, |
|
| 554 | + 'update' => 'CURRENT_TIMESTAMP', |
|
| 555 | + 'timezone' => $withTimezone, |
|
| 556 | + ]); |
|
| 557 | 557 | |
| 558 | 558 | return $this; |
| 559 | 559 | } |
@@ -56,9 +56,9 @@ |
||
| 56 | 56 | |
| 57 | 57 | $fk = new ForeignKey(); |
| 58 | 58 | $fk->setReferencedTable($referencedTable) |
| 59 | - ->setColumns($columns) |
|
| 60 | - ->setReferencedColumns($referencedColumns) |
|
| 61 | - ->setOptions($options); |
|
| 59 | + ->setColumns($columns) |
|
| 60 | + ->setReferencedColumns($referencedColumns) |
|
| 61 | + ->setOptions($options); |
|
| 62 | 62 | |
| 63 | 63 | if ($name !== null) { |
| 64 | 64 | $fk->setConstraint($name); |
@@ -414,7 +414,7 @@ |
||
| 414 | 414 | && !($action instanceof RemoveColumn) |
| 415 | 415 | && !($action instanceof RenameColumn) |
| 416 | 416 | ) { |
| 417 | - continue; |
|
| 417 | + continue; |
|
| 418 | 418 | } elseif (isset($this->tableCreates[$action->getTable()->getName()])) { |
| 419 | 419 | continue; |
| 420 | 420 | } |
@@ -8,8 +8,8 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | return function () { |
| 10 | 10 | $files = [ |
| 11 | - __DIR__ . '/../../../autoload.php', // composer dependency |
|
| 12 | - __DIR__ . '/../vendor/autoload.php', // stand-alone package |
|
| 11 | + __DIR__ . '/../../../autoload.php', // composer dependency |
|
| 12 | + __DIR__ . '/../vendor/autoload.php', // stand-alone package |
|
| 13 | 13 | ]; |
| 14 | 14 | foreach ($files as $file) { |
| 15 | 15 | if (is_file($file)) { |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | // Handle id => "field_name" to support AUTO_INCREMENT |
| 371 | 371 | $column = new Column(); |
| 372 | 372 | $column->setName($options['id']) |
| 373 | - ->setType('integer') |
|
| 374 | - ->setIdentity(true); |
|
| 373 | + ->setType('integer') |
|
| 374 | + ->setIdentity(true); |
|
| 375 | 375 | |
| 376 | 376 | if (isset($options['limit'])) { |
| 377 | 377 | $column->setLimit($options['limit']); |
@@ -655,12 +655,12 @@ discard block |
||
| 655 | 655 | $default = $this->parseDefaultValue($columnInfo['dflt_value'], $type['name']); |
| 656 | 656 | |
| 657 | 657 | $column->setName($columnInfo['name']) |
| 658 | - ->setNull($columnInfo['notnull'] !== '1') |
|
| 659 | - ->setDefault($default) |
|
| 660 | - ->setType($type['name']) |
|
| 661 | - ->setLimit($type['limit']) |
|
| 662 | - ->setScale($type['scale']) |
|
| 663 | - ->setIdentity($columnInfo['name'] === $identity); |
|
| 658 | + ->setNull($columnInfo['notnull'] !== '1') |
|
| 659 | + ->setDefault($default) |
|
| 660 | + ->setType($type['name']) |
|
| 661 | + ->setLimit($type['limit']) |
|
| 662 | + ->setScale($type['scale']) |
|
| 663 | + ->setIdentity($columnInfo['name'] === $identity); |
|
| 664 | 664 | |
| 665 | 665 | $columns[] = $column; |
| 666 | 666 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $options = $table->getOptions(); |
| 202 | 202 | $parts = $this->getSchemaName($table->getName()); |
| 203 | 203 | |
| 204 | - // Add the default primary key |
|
| 204 | + // Add the default primary key |
|
| 205 | 205 | if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { |
| 206 | 206 | $options['id'] = 'id'; |
| 207 | 207 | } |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | // Handle id => "field_name" to support AUTO_INCREMENT |
| 211 | 211 | $column = new Column(); |
| 212 | 212 | $column->setName($options['id']) |
| 213 | - ->setType('integer') |
|
| 214 | - ->setIdentity(true); |
|
| 213 | + ->setType('integer') |
|
| 214 | + ->setIdentity(true); |
|
| 215 | 215 | |
| 216 | 216 | if (isset($options['limit'])) { |
| 217 | 217 | $column->setLimit($options['limit']); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - // set the primary key(s) |
|
| 241 | + // set the primary key(s) |
|
| 242 | 242 | if (isset($options['primary_key'])) { |
| 243 | 243 | $sql = rtrim($sql); |
| 244 | 244 | $sql .= sprintf(' CONSTRAINT %s PRIMARY KEY (', $this->quoteColumnName($parts['table'] . '_pkey')); |
@@ -433,11 +433,11 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | $column = new Column(); |
| 435 | 435 | $column->setName($columnInfo['column_name']) |
| 436 | - ->setType($columnType) |
|
| 437 | - ->setNull($columnInfo['is_nullable'] === 'YES') |
|
| 438 | - ->setDefault($columnDefault) |
|
| 439 | - ->setIdentity($columnInfo['is_identity'] === 'YES') |
|
| 440 | - ->setScale($columnInfo['numeric_scale']); |
|
| 436 | + ->setType($columnType) |
|
| 437 | + ->setNull($columnInfo['is_nullable'] === 'YES') |
|
| 438 | + ->setDefault($columnDefault) |
|
| 439 | + ->setIdentity($columnInfo['is_identity'] === 'YES') |
|
| 440 | + ->setScale($columnInfo['numeric_scale']); |
|
| 441 | 441 | |
| 442 | 442 | if (preg_match('/\bwith time zone$/', $columnInfo['data_type'])) { |
| 443 | 443 | $column->setTimezone(true); |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | // Handle id => "field_name" to support AUTO_INCREMENT |
| 268 | 268 | $column = new Column(); |
| 269 | 269 | $column->setName($options['id']) |
| 270 | - ->setType('integer') |
|
| 271 | - ->setSigned(isset($options['signed']) ? $options['signed'] : true) |
|
| 272 | - ->setIdentity(true); |
|
| 270 | + ->setType('integer') |
|
| 271 | + ->setSigned(isset($options['signed']) ? $options['signed'] : true) |
|
| 272 | + ->setIdentity(true); |
|
| 273 | 273 | |
| 274 | 274 | if (isset($options['limit'])) { |
| 275 | 275 | $column->setLimit($options['limit']); |
@@ -444,12 +444,12 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | $column = new Column(); |
| 446 | 446 | $column->setName($columnInfo['Field']) |
| 447 | - ->setNull($columnInfo['Null'] !== 'NO') |
|
| 448 | - ->setDefault($columnInfo['Default']) |
|
| 449 | - ->setType($phinxType['name']) |
|
| 450 | - ->setSigned(strpos($columnInfo['Type'], 'unsigned') === false) |
|
| 451 | - ->setLimit($phinxType['limit']) |
|
| 452 | - ->setScale($phinxType['scale']); |
|
| 447 | + ->setNull($columnInfo['Null'] !== 'NO') |
|
| 448 | + ->setDefault($columnInfo['Default']) |
|
| 449 | + ->setType($phinxType['name']) |
|
| 450 | + ->setSigned(strpos($columnInfo['Type'], 'unsigned') === false) |
|
| 451 | + ->setLimit($phinxType['limit']) |
|
| 452 | + ->setScale($phinxType['scale']); |
|
| 453 | 453 | |
| 454 | 454 | if ($columnInfo['Extra'] === 'auto_increment') { |
| 455 | 455 | $column->setIdentity(true); |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | // Handle id => "field_name" to support AUTO_INCREMENT |
| 236 | 236 | $column = new Column(); |
| 237 | 237 | $column->setName($options['id']) |
| 238 | - ->setType('integer') |
|
| 239 | - ->setIdentity(true); |
|
| 238 | + ->setType('integer') |
|
| 239 | + ->setIdentity(true); |
|
| 240 | 240 | |
| 241 | 241 | if (isset($options['limit'])) { |
| 242 | 242 | $column->setLimit($options['limit']); |
@@ -469,11 +469,11 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | $column = new Column(); |
| 471 | 471 | $column->setName($columnInfo['name']) |
| 472 | - ->setType($type) |
|
| 473 | - ->setNull($columnInfo['null'] !== 'NO') |
|
| 474 | - ->setDefault($this->parseDefault($columnInfo['default'])) |
|
| 475 | - ->setIdentity($columnInfo['identity'] === '1') |
|
| 476 | - ->setComment($this->getColumnComment($columnInfo['table_name'], $columnInfo['name'])); |
|
| 472 | + ->setType($type) |
|
| 473 | + ->setNull($columnInfo['null'] !== 'NO') |
|
| 474 | + ->setDefault($this->parseDefault($columnInfo['default'])) |
|
| 475 | + ->setIdentity($columnInfo['identity'] === '1') |
|
| 476 | + ->setComment($this->getColumnComment($columnInfo['table_name'], $columnInfo['name'])); |
|
| 477 | 477 | |
| 478 | 478 | if (!empty($columnInfo['char_length'])) { |
| 479 | 479 | $column->setLimit($columnInfo['char_length']); |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | |
| 796 | 796 | foreach ($indexes as $name => $index) { |
| 797 | 797 | if ($name === $indexName) { |
| 798 | - return true; |
|
| 798 | + return true; |
|
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | |