diff --git a/src/main/antlr4/imports/mysql_create_table.g4 b/src/main/antlr4/imports/mysql_create_table.g4 index 21786293d..9024a2c2e 100644 --- a/src/main/antlr4/imports/mysql_create_table.g4 +++ b/src/main/antlr4/imports/mysql_create_table.g4 @@ -43,6 +43,7 @@ table_creation_option: | creation_storage_option | creation_tablespace | creation_union + | creation_encryption | partition_by; @@ -70,3 +71,5 @@ creation_stats_sample_pages: STATS_SAMPLE_PAGES '='? INTEGER_LITERAL; creation_storage_option: STORAGE (DISK | MEMORY | DEFAULT); creation_tablespace: TABLESPACE string; creation_union: UNION '='? '(' name (',' name)* ')'; +creation_encryption: ENCRYPTION '='? string_literal; + 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 adb123c93..29967d296 100644 --- a/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java +++ b/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java @@ -1,7 +1,7 @@ package com.zendesk.maxwell.schema.ddl; import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.io.FileOutputStream; @@ -12,12 +12,11 @@ import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.ObjectMapper; import com.zendesk.maxwell.schema.columndef.ColumnDef; -import org.junit.*; import com.zendesk.maxwell.schema.columndef.*; +import org.junit.Test; +import org.junit.Ignore; public class DDLParserTest { public String getSQLDir() { @@ -251,7 +250,8 @@ public void testParsingSomeAlters() { "alter table f add column i varchar(255) default ('environment,namespace,table_name')", "CREATE DATABASE xyz DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT ENCRYPTION='N'", "CREATE TABLE testTable18 ( command JSON NOT NULL DEFAULT (JSON_QUOTE(\"{'parent':'sched'}\")) )", - "CREATE TABLE testTable19 ( pid BIGINT NOT NULL DEFAULT(1) )" + "CREATE TABLE testTable19 ( pid BIGINT NOT NULL DEFAULT(1) )", + "CREATE TABLE encRTYPE ( i int ) ENCRYPTION='Y'" }; for ( String s : testSQL ) { @@ -259,7 +259,7 @@ public void testParsingSomeAlters() { SchemaChange parsed = parse(s).get(0); assertThat("Expected " + s + "to parse", parsed, not(nullValue())); } catch ( MaxwellSQLSyntaxError e ) { - assertThat("Expected " + s + "to parse, but got: " + e.getMessage(), true, is(false)); + assertThat("Expected '" + s + "' to parse, but got: " + e.getMessage(), true, is(false)); } }