Skip to content

Commit ee2330a

Browse files
committed
DROP index if exists
1 parent 794cddd commit ee2330a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/antlr4/imports/mysql_alter_table.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ignored_alter_specifications:
5959
ADD index_definition
6060
| ALTER INDEX name (VISIBLE | INVISIBLE)
6161
| ALTER COLUMN? name ((SET DEFAULT literal) | (DROP DEFAULT) | (SET (VISIBLE | INVISIBLE)))
62-
| DROP INDEX index_name
62+
| DROP INDEX if_exists? index_name
6363
| DISABLE KEYS
6464
| ENABLE KEYS
6565
| ORDER BY alter_ordering (',' alter_ordering)*

src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,11 @@ public void testParsingSomeAlters() {
269269
"CREATE TABLE employees (data JSON, INDEX idx ((CAST(data->>'$.name' AS CHAR(30)) COLLATE utf8mb4_bin)))",
270270
"ALTER TABLE tasks DROP COLUMN IF EXISTS snoozed_until",
271271
"ALTER TABLE outgoing_notifications_log ADD INDEX idx_campaign_updated (campaign, last_updated_at) ALGORITHM=NOCOPY,LOCK=NONE",
272-
"alter table test.c ALGORITHM=COPY, STATS_SAMPLE_PAGES=DEFAULT"
272+
"alter table test.c ALGORITHM=COPY, STATS_SAMPLE_PAGES=DEFAULT",
273+
"ALTER TABLE vehicles " +
274+
"DROP INDEX IF EXISTS uq_vehicles_oem_id_oem_vin," +
275+
"ALGORITHM=NOCOPY, LOCK=NONE"
276+
273277
};
274278

275279
for ( String s : testSQL ) {

0 commit comments

Comments
 (0)