From f8a5b4f92cf2785a4f7dea2faa8fab814a2a6f42 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 11 Dec 2025 15:52:19 +0800 Subject: [PATCH] bugfix --- setup.cfg | 2 +- sqlor/ddl_template_mysql.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 8f90ec6..ad48f7e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name=sqlor -version = 2.0.3 +version = 2.1.0 description = a new version of sqlor, each db's sor need to plugin to sqlor, and dbdriver now a isolated module authors = yu moqing author_email = yumoqing@gmail.com diff --git a/sqlor/ddl_template_mysql.py b/sqlor/ddl_template_mysql.py index 70c3815..07ea8da 100755 --- a/sqlor/ddl_template_mysql.py +++ b/sqlor/ddl_template_mysql.py @@ -18,7 +18,7 @@ datetime {%- elif type=='timestamp' -%} TIMESTAMP DEFAULT CURRENT_TIMESTAMP {%- elif type=='text' -%} -longtext +longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci {%- elif type=='bin' -%} longblob {%- else -%} @@ -38,6 +38,8 @@ NOT NULL {% macro primary() %} ,primary key({{','.join(summary[0].primary)}}) {% endmacro %} +-- 建库时请用以下语句,支持emoji字符 +-- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; drop table if exists {{summary[0].name}}; CREATE TABLE {{summary[0].name}} ( @@ -48,8 +50,9 @@ CREATE TABLE {{summary[0].name}} {{primary()}} {% endif %} ) +CHARACTER SET utf8mb4 +COLLATE utf8mb4_unicode_ci engine=innodb -default charset=utf8 {% if summary[0].title %}comment '{{summary[0].title}}'{% endif %} ; {% for v in indexes %}