aerich icon indicating copy to clipboard operation
aerich copied to clipboard

[Feature] Use ENUM instead of VARCHAR for CharEnumField

Open ninanomenon opened this issue 3 years ago • 1 comments

I noticed that aerich handles enums strangely. Instead of creating them as ENUM field in the table, a VARCHAR(length of the longest field in the enum) is used and the intended values are stored as a commetar at the field.

However, this currently leads to problems for me, I have relatively many entries in an enum, which is why I get an error when I try to execute the migration.

pymysql.err.OperationalError: (1629, "Comment for field 'type' is too long (max = 1024)")

My workaround is to remove the comment field from the migration. However, this is a bit annoying in the long run, because aerich tries to add the comment every time I create a new migration.

Is there any plan to support enum fields in the database as well?

ninanomenon avatar Nov 14 '22 13:11 ninanomenon

Wait for tortoise-orm to support it: https://github.com/tortoise/tortoise-orm/issues/937

waketzheng avatar Dec 12 '24 03:12 waketzheng