Add support for table-level comments (#946)

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
ehoeve 2023-08-17 12:44:55 +02:00 committed by GitHub
parent 8bbb85356c
commit 83e30677b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 0 deletions

View file

@ -296,6 +296,22 @@ fn parse_create_table_auto_increment() {
}
}
#[test]
fn parse_create_table_comment() {
let canonical = "CREATE TABLE foo (bar INT) COMMENT 'baz'";
let with_equal = "CREATE TABLE foo (bar INT) COMMENT = 'baz'";
for sql in [canonical, with_equal] {
match mysql().one_statement_parses_to(sql, canonical) {
Statement::CreateTable { name, comment, .. } => {
assert_eq!(name.to_string(), "foo");
assert_eq!(comment.expect("Should exist").to_string(), "baz");
}
_ => unreachable!(),
}
}
}
#[test]
fn parse_create_table_set_enum() {
let sql = "CREATE TABLE foo (bar SET('a', 'b'), baz ENUM('a', 'b'))";