-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use provided length for enum type if given for non-mysql platform #7034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.4.x
Are you sure you want to change the base?
Conversation
2523651
to
f34ba6a
Compare
752f6cf
to
055946f
Compare
What's the problem with future |
First, it feels odd to have
not throwing an error if the length is not used at all. Then, running If someone wants futur ALTER TABLE, he just have to not provide any length in the column.
Mysql use specific syntax For example with Postgres, we can define constraint check
and when changing the enum, only the constraint is needed to be updated, but there is no gain to update the field length everytime (if we create the field with a bigger length first time). |
It will also not throw if you assign a precision to that column. 🤷🏻♂️
The column has variable length already, so the operation of changing the maximum column length itself is cheap. However, if the column is part of an index, that index might need to be rebuilt which can be expesinve.
Yeah, allowing to specify the length of the varchar field is reasonable. I think, we should allow it. |
89241ce
to
cceced6
Compare
cceced6
to
1b455bc
Compare
Summary
When a Type Enum is used AND a length
the length is not used at all when generating the sql.
This makes sens for MysqlPlatform which list all the possible case, but for non-mysql platform it could be a way to reserved more length in advance in order to avoid futur ALTER TABLE.
The current strategy is too look at the max length of all the existing values, which means that adding new enum values might trigger every time an ALTER table just to use a bigger length.