diff --git a/src/main/antlr4/imports/mysql_alter_table.g4 b/src/main/antlr4/imports/mysql_alter_table.g4 index 980aa3bf7..cc86a54c3 100644 --- a/src/main/antlr4/imports/mysql_alter_table.g4 +++ b/src/main/antlr4/imports/mysql_alter_table.g4 @@ -59,7 +59,7 @@ ignored_alter_specifications: ADD index_definition | ALTER INDEX name (VISIBLE | INVISIBLE) | ALTER COLUMN? name ((SET DEFAULT literal) | (DROP DEFAULT) | (SET (VISIBLE | INVISIBLE))) - | DROP INDEX index_name + | DROP INDEX if_exists? index_name | DISABLE KEYS | ENABLE KEYS | ORDER BY alter_ordering (',' alter_ordering)* diff --git a/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java b/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java index c3588b147..df9a7efe9 100644 --- a/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java +++ b/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java @@ -269,7 +269,11 @@ public void testParsingSomeAlters() { "CREATE TABLE employees (data JSON, INDEX idx ((CAST(data->>'$.name' AS CHAR(30)) COLLATE utf8mb4_bin)))", "ALTER TABLE tasks DROP COLUMN IF EXISTS snoozed_until", "ALTER TABLE outgoing_notifications_log ADD INDEX idx_campaign_updated (campaign, last_updated_at) ALGORITHM=NOCOPY,LOCK=NONE", - "alter table test.c ALGORITHM=COPY, STATS_SAMPLE_PAGES=DEFAULT" + "alter table test.c ALGORITHM=COPY, STATS_SAMPLE_PAGES=DEFAULT", + "ALTER TABLE vehicles " + + "DROP INDEX IF EXISTS uq_vehicles_oem_id_oem_vin," + + "ALGORITHM=NOCOPY, LOCK=NONE" + }; for ( String s : testSQL ) {