-
-
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
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure this new behavior is covered by a functional test as well.
If I look at your original PR the only functional test is for MySql https://github.com/doctrine/dbal/pull/6536/files#diff-5c5395e4aacfd52ec445d9845a95e2fd534deeaa427ad12b95ffab58127ceffaR16 which is not concerned here. I'm basically doing the same than #6579 which didn't add functional tests. I feel like the changed are already 100% covered by the unit test. I'm not sure which functional test should be added ? @derrabus |
697ac8b
to
7ca0e97
Compare
7ca0e97
to
28a947b
Compare
Thanks. The documentation needs a little update as well, I suppose. |
Thank you! |
Thanks to you too ! Also, I have two extra question @derrabus ;
Thanks and good weekend |
I've seen that one and it's on my list. 🤞🏻 |
We don't have a fixed schedule for releases. We do releases as we see fit. |
* 4.4.x: CI: Update SQL Server to version 2022 (doctrine#7069) fix(MariaDb): add support of new reserved word `VECTOR` (11.7+) (doctrine#7061) Improve deprecation Update schema definition documentaion Fix binding null as a boolean parameter on pgsql (doctrine#7059) Use provided length for enum type if given for non-mysql platform (doctrine#7034)
* 4.4.x: CI: Update SQL Server to version 2022 (doctrine#7069) fix(MariaDb): add support of new reserved word `VECTOR` (11.7+) (doctrine#7061) Improve deprecation Update schema definition documentaion Fix binding null as a boolean parameter on pgsql (doctrine#7059) Use provided length for enum type if given for non-mysql platform (doctrine#7034)
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.