Open dyuzhou opened 2 years ago
How did you create the table?
你是如何创建表格的?
class Hospital(Model): class Meta: table = 'hospital'
id = fields.CharField(max_length=50, pk=True, index=True, description='医院ID')
name = fields.CharField(max_length=255, default=None, null=True, description='医院名称')
alias = fields.TextField(default=None, null=True, description='医院-所有名称名称')
create_time = fields.DatetimeField(null=False, auto_now_add=True, description='创建时间')
update_time = fields.DatetimeField(null=False, auto_now=True, description='更新时间')
table_description = '医院表'
async def init(): await Tortoise.init( db_url=settings.db_url, modules={'models': ['models.model']} ) await Tortoise.generate_schemas()
async def close_db(): await Tortoise.close_connections()
if name == 'main':
from tortoise import run_async
run_async(init())
Tortoise will not set that, you can check other
Tortoise can set CHARSET, but not support COLLATE. you can see function "_table_generate_extra " in "site-packages\tortoise\backends\mysql\schema_generator.py"
Can this issues be solved?
Describe the bug CHARSET=utf8mb4,COLLATE=utf8mb4_general_ci They are configured in the mysql configuration file and the database used, but after I use tortoise-orm to create the table, they all use CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
To Reproduce Steps to reproduce the behavior, preferably a small code snippet.
Expected behavior I want the table he created to also use CHARSET=utf8mb4,COLLATE=utf8mb4_general_ci,Is it a problem of aiomysql or tortoise-orm? what should I do