-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
EnumDropCommentCommand does not work on MySQL #197
Comments
Hi. Sorry for the late answer. Looks like it is a bug in Doctrine. My console command gets platform from the config $connection = $this->em->getConnection();
$platform = $connection->getDatabasePlatform();
if (!$platform instanceof AbstractPlatform) {
throw new RuntimeException('Missing database platform for connection.', 3);
} So the SQL statement comes from Doctrine And then $sql = $platform->getCommentOnColumnSQL($tableName, $fieldMappingDetails['columnName'], null);
$connection->executeQuery($sql); |
@fre5h hey, I've looked into this some more. I can see the statement comes from Doctrine - I also mention this in the description. The issue here is that I don't think it's correct to use Even though It's not really your fault, looks like this is just another inconsistency in Doctrine 🤷♂️ . Maybe the command could also have a check for the platform and fail early with an error message if used with MySQL. If you agree with this I can open a PR. |
I just discovered this bug for MariaDB also (which I know is essentially MySQL). but thought it was worth the mention. Any workaround? |
My workaround was to just write the migration query manually whenever an enum's values needed to change (which should not happen often ideally!). For example if we have an enum BasketballPositionType: ALTER TABLE players CHANGE position position ENUM('PG', 'SG', 'SF', 'PF', 'C') NOT NULL COMMENT '(DC2Type:BasketballPositionType)' My other recommendation would be to get on PHP 8.1 and Doctrine >= 2.11 because it supports the new native PHP Enum type: https://www.doctrine-project.org/2022/01/11/orm-2.11.html. |
Hello!
I'm trying the new addition command to drop comments mentioned here: https://github.com/fre5h/DoctrineEnumBundle/blob/main/Resources/docs/hook_for_doctrine_migrations.md#console-command-for-dropping-comments. However, it doesn't look like the SQL generated is valid for MySQL (I'm using 5.7 but I suspect the same holds true for 8.0).
I can see this SQL is generated by Doctrine here so it's a bit unclear to me why the correct statement is not used. The correct statement would be something on the lines of:
Is there something wrong in my setup or what could be the issue here?
The text was updated successfully, but these errors were encountered: