Skip to content

Commit

Permalink
Merge pull request #167 from zendesk/ben/schema_alias_for_db
Browse files Browse the repository at this point in the history
SCHEMA is an alias for DATABASE
  • Loading branch information
Ben Osheroff committed Nov 27, 2015
2 parents 1f9ac04 + 52cda0f commit e4841cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/antlr4/com/zendesk/maxwell/schema/ddl/mysql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ statement:
| BEGIN
;




create_database:
CREATE DATABASE if_not_exists? name (default_character_set | default_collate)*;
CREATE (DATABASE | SCHEMA) if_not_exists? name (default_character_set | default_collate)*;

create_table:
create_table_preamble
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,13 @@ public void testCreateDatabase() {
assertThat(create.encoding, is("latin1"));
}

@Test
public void testCreateSchema() {
List<SchemaChange> changes = parse("CREATE SCHEMA if not exists `foo`");
DatabaseCreate create = (DatabaseCreate) changes.get(0);
assertThat(create.dbName, is("foo"));
}

@Test
public void testCommentSyntax() {
List<SchemaChange> changes = parse("CREATE DATABASE if not exists `foo` default character set='latin1' /* generate by server */");
Expand Down

0 comments on commit e4841cb

Please sign in to comment.