| @@ 886-900 (lines=15) @@ | ||
| 883 | /** |
|
| 884 | * @group DBAL-234 |
|
| 885 | */ |
|
| 886 | public function testAlterTableRenameIndex() |
|
| 887 | { |
|
| 888 | $tableDiff = new TableDiff('mytable'); |
|
| 889 | $tableDiff->fromTable = new Table('mytable'); |
|
| 890 | $tableDiff->fromTable->addColumn('id', 'integer'); |
|
| 891 | $tableDiff->fromTable->setPrimaryKey(array('id')); |
|
| 892 | $tableDiff->renamedIndexes = array( |
|
| 893 | 'idx_foo' => new Index('idx_bar', array('id')) |
|
| 894 | ); |
|
| 895 | ||
| 896 | self::assertSame( |
|
| 897 | $this->getAlterTableRenameIndexSQL(), |
|
| 898 | $this->_platform->getAlterTableSQL($tableDiff) |
|
| 899 | ); |
|
| 900 | } |
|
| 901 | ||
| 902 | /** |
|
| 903 | * @group DBAL-234 |
|
| @@ 1041-1055 (lines=15) @@ | ||
| 1038 | /** |
|
| 1039 | * @group DBAL-807 |
|
| 1040 | */ |
|
| 1041 | public function testAlterTableRenameIndexInSchema() |
|
| 1042 | { |
|
| 1043 | $tableDiff = new TableDiff('myschema.mytable'); |
|
| 1044 | $tableDiff->fromTable = new Table('myschema.mytable'); |
|
| 1045 | $tableDiff->fromTable->addColumn('id', 'integer'); |
|
| 1046 | $tableDiff->fromTable->setPrimaryKey(array('id')); |
|
| 1047 | $tableDiff->renamedIndexes = array( |
|
| 1048 | 'idx_foo' => new Index('idx_bar', array('id')) |
|
| 1049 | ); |
|
| 1050 | ||
| 1051 | self::assertSame( |
|
| 1052 | $this->getAlterTableRenameIndexInSchemaSQL(), |
|
| 1053 | $this->_platform->getAlterTableSQL($tableDiff) |
|
| 1054 | ); |
|
| 1055 | } |
|
| 1056 | ||
| 1057 | /** |
|
| 1058 | * @group DBAL-807 |
|
| @@ 857-870 (lines=14) @@ | ||
| 854 | /** |
|
| 855 | * @group DBAL-234 |
|
| 856 | */ |
|
| 857 | public function testAlterTableRenameForeignKey(): void |
|
| 858 | { |
|
| 859 | $tableDiff = new TableDiff('mytable'); |
|
| 860 | $tableDiff->fromTable = new Table('mytable'); |
|
| 861 | $tableDiff->fromTable->addColumn('fk', 'integer'); |
|
| 862 | $tableDiff->renamedForeignKeys = array( |
|
| 863 | 'fk1' => new ForeignKeyConstraint(array('fk'), 'fk_table', array('id'), 'fk2') |
|
| 864 | ); |
|
| 865 | ||
| 866 | self::assertSame( |
|
| 867 | $this->getAlterTableRenameForeignKeySQL(), |
|
| 868 | $this->_platform->getAlterTableSQL($tableDiff) |
|
| 869 | ); |
|
| 870 | } |
|
| 871 | ||
| 872 | /** |
|
| 873 | * @group DBAL-234 |
|