DBZ-1329 Support for rename index

This commit is contained in:
Jiri Pechanec 2019-06-14 11:30:48 +02:00 committed by Gunnar Morling
parent 72b751b528
commit e2f2c88952
2 changed files with 15 additions and 0 deletions

View File

@ -1610,6 +1610,20 @@ public void shouldParseAlterTableWithDropIndex() {
listener.forEach(this::printEvent);
}
@Test
@FixFor("DBZ-1329")
public void shouldParseAlterTableWithIndex() {
final String ddl = "USE db;"
+ "CREATE TABLE db.t1 (ID INTEGER PRIMARY KEY, val INTEGER, INDEX myidx(val));"
+ "ALTER TABLE db.t1 RENAME INDEX myidx to myidx2;";
parser = new MysqlDdlParserWithSimpleTestListener(listener, true);
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
final Table table = tables.forTable(new TableId(null, "db", "t1"));
assertThat(table).isNotNull();
assertThat(table.columns()).hasSize(2);
}
@FixFor("DBZ-437")
@Test
public void shouldParseStringSameAsKeyword() {

View File

@ -618,6 +618,7 @@ alterSpecification
| DROP COLUMN? uid RESTRICT? #alterByDropColumn
| DROP PRIMARY KEY #alterByDropPrimaryKey
| DROP indexFormat=(INDEX | KEY) uid #alterByDropIndex
| RENAME indexFormat=(INDEX | KEY) uid TO uid #alterByRenameIndex
| DROP FOREIGN KEY uid #alterByDropForeignKey
| DISABLE KEYS #alterByDisableKeys
| ENABLE KEYS #alterByEnableKeys