video-shuoshan/backend/apps/generation/migrations/0005_convert_utf8mb4.py
2026-03-17 10:38:35 +08:00

27 lines
956 B
Python

"""Convert GenerationRecord table to utf8mb4 to support emoji/4-byte Unicode in prompt field.
Bug #65: OperationalError (1366) "Incorrect string value" when prompt contains emoji characters.
"""
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('generation', '0004_alter_generationrecord_model'),
]
operations = [
migrations.RunSQL(
sql=[
"ALTER TABLE generation_generationrecord CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;",
"ALTER TABLE generation_quotaconfig CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;",
],
reverse_sql=[
"ALTER TABLE generation_generationrecord CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;",
"ALTER TABLE generation_quotaconfig CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;",
],
),
]