|
@@ 473-494 (lines=22) @@
|
| 470 |
|
/** |
| 471 |
|
* @group 2916 |
| 472 |
|
*/ |
| 473 |
|
public function testAlterTableAutoIncrementIntToBigInt() : void |
| 474 |
|
{ |
| 475 |
|
$tableFrom = new Table('autoinc_table_int_to_bigint'); |
| 476 |
|
$column = $tableFrom->addColumn('id', 'integer'); |
| 477 |
|
$column->setAutoincrement(true); |
| 478 |
|
$this->_sm->createTable($tableFrom); |
| 479 |
|
$tableFrom = $this->_sm->listTableDetails('autoinc_table_int_to_bigint'); |
| 480 |
|
self::assertTrue($tableFrom->getColumn('id')->getAutoincrement()); |
| 481 |
|
|
| 482 |
|
$tableTo = new Table('autoinc_table_int_to_bigint'); |
| 483 |
|
$column = $tableTo->addColumn('id', 'bigint'); |
| 484 |
|
$column->setAutoincrement(true); |
| 485 |
|
|
| 486 |
|
$c = new Comparator(); |
| 487 |
|
$diff = $c->diffTable($tableFrom, $tableTo); |
| 488 |
|
self::assertInstanceOf(TableDiff::class, $diff, "There should be a difference and not false being returned from the table comparison"); |
| 489 |
|
self::assertSame(["ALTER TABLE autoinc_table_int_to_bigint ALTER id TYPE BIGINT"], $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff)); |
| 490 |
|
|
| 491 |
|
$this->_sm->alterTable($diff); |
| 492 |
|
$tableFinal = $this->_sm->listTableDetails('autoinc_table_int_to_bigint'); |
| 493 |
|
self::assertTrue($tableFinal->getColumn('id')->getAutoincrement()); |
| 494 |
|
} |
| 495 |
|
|
| 496 |
|
/** |
| 497 |
|
* @group 2916 |
|
@@ 499-520 (lines=22) @@
|
| 496 |
|
/** |
| 497 |
|
* @group 2916 |
| 498 |
|
*/ |
| 499 |
|
public function testAlterTableAutoIncrementBigIntToInt() : void |
| 500 |
|
{ |
| 501 |
|
$tableFrom = new Table('autoinc_table_bigint_to_int'); |
| 502 |
|
$column = $tableFrom->addColumn('id', 'bigint'); |
| 503 |
|
$column->setAutoincrement(true); |
| 504 |
|
$this->_sm->createTable($tableFrom); |
| 505 |
|
$tableFrom = $this->_sm->listTableDetails('autoinc_table_bigint_to_int'); |
| 506 |
|
self::assertTrue($tableFrom->getColumn('id')->getAutoincrement()); |
| 507 |
|
|
| 508 |
|
$tableTo = new Table('autoinc_table_bigint_to_int'); |
| 509 |
|
$column = $tableTo->addColumn('id', 'integer'); |
| 510 |
|
$column->setAutoincrement(true); |
| 511 |
|
|
| 512 |
|
$c = new Comparator(); |
| 513 |
|
$diff = $c->diffTable($tableFrom, $tableTo); |
| 514 |
|
self::assertInstanceOf(TableDiff::class, $diff, "There should be a difference and not false being returned from the table comparison"); |
| 515 |
|
self::assertSame(["ALTER TABLE autoinc_table_bigint_to_int ALTER id TYPE INT"], $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff)); |
| 516 |
|
|
| 517 |
|
$this->_sm->alterTable($diff); |
| 518 |
|
$tableFinal = $this->_sm->listTableDetails('autoinc_table_bigint_to_int'); |
| 519 |
|
self::assertTrue($tableFinal->getColumn('id')->getAutoincrement()); |
| 520 |
|
} |
| 521 |
|
} |
| 522 |
|
|
| 523 |
|
class MoneyType extends Type |