summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_mysql.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-30 05:07:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-30 05:07:13 +0000
commit276f5723c8ab7e0b2938693db546dbd30be3f01a (patch)
treee6294c63de34a03e373245ec4cb1efbca1edfe61 /tests/dialects/test_mysql.py
parentAdding upstream version 6.2.1. (diff)
downloadsqlglot-276f5723c8ab7e0b2938693db546dbd30be3f01a.tar.xz
sqlglot-276f5723c8ab7e0b2938693db546dbd30be3f01a.zip
Adding upstream version 6.2.6.upstream/6.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_mysql.py')
-rw-r--r--tests/dialects/test_mysql.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
index 87a3d64..02dc1ad 100644
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -119,3 +119,39 @@ class TestMySQL(Validator):
"sqlite": "GROUP_CONCAT(DISTINCT x ORDER BY y DESC, '')",
},
)
+ self.validate_identity(
+ "CREATE TABLE z (a INT) ENGINE=InnoDB AUTO_INCREMENT=1 CHARACTER SET=utf8 COLLATE=utf8_bin COMMENT='x'"
+ )
+ self.validate_identity(
+ "CREATE TABLE z (a INT) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARACTER SET=utf8 COLLATE=utf8_bin COMMENT='x'"
+ )
+ self.validate_identity(
+ "CREATE TABLE z (a INT DEFAULT NULL, PRIMARY KEY(a)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARACTER SET=utf8 COLLATE=utf8_bin COMMENT='x'"
+ )
+
+ self.validate_all(
+ """
+ CREATE TABLE `t_customer_account` (
+ "id" int(11) NOT NULL AUTO_INCREMENT,
+ "customer_id" int(11) DEFAULT NULL COMMENT '客户id',
+ "bank" varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '行别',
+ "account_no" varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '账号',
+ PRIMARY KEY ("id")
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARACTER SET=utf8 COLLATE=utf8_bin COMMENT='客户账户表'
+ """,
+ write={
+ "mysql": """CREATE TABLE `t_customer_account` (
+ 'id' INT(11) NOT NULL AUTO_INCREMENT,
+ 'customer_id' INT(11) DEFAULT NULL COMMENT '客户id',
+ 'bank' VARCHAR(100) COLLATE utf8_bin DEFAULT NULL COMMENT '行别',
+ 'account_no' VARCHAR(100) COLLATE utf8_bin DEFAULT NULL COMMENT '账号',
+ PRIMARY KEY('id')
+)
+ENGINE=InnoDB
+AUTO_INCREMENT=1
+DEFAULT CHARACTER SET=utf8
+COLLATE=utf8_bin
+COMMENT='客户账户表'"""
+ },
+ pretty=True,
+ )