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
Regression on charset/collate from v3.2.2 to v3.3.2 #5321
Comments
@marforon how exactly does one reproduce the issue you're experiencing? The SQL in the description doesn't seem to be enough. What version of MySQL are you using? FWIW, on MySQL 8, the table created from the DDL in the description is introspected like this:
Note that the charset name is |
@morozov I think it's fine as you have it. Try to do $this->addSql('CREATE TABLE notification_event (name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); My exact version is 8.0.26. (Not sure which version it was when I first run this migration, but it doesn't matter in my case, I can replicate it from the scratch on this version) So to replicate this: 1 Require doctrine/dbal 3.2.2 CREATE TABLE `notification_event` (
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
The following SQL statements will be executed:
ALTER TABLE notification_event CHANGE name name VARCHAR(255) NOT NULL; |
Could you try reproducing this issue without the ORM and Symfony? |
@morozov sure, hope it helps: $connection = DriverManager::getConnection(['url' => 'mysql://root:root@127.0.0.1:3306/test?serverVersion=8.0']);
$connection->executeQuery('CREATE TABLE IF NOT EXISTS `test` (`name` VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\';');
$schemaManager = $connection->createSchemaManager();
$fromSchema = $schemaManager->createSchema();
$toSchema = new Schema([], [], $schemaManager->createSchemaConfig());
$toSchema->createTable('test')->addColumn(
'name',
Types::STRING,
['length' => 255, 'notnull' => true, 'platformOptions' => ['version' => false]]
);
$diff = $schemaManager->createComparator()->compareSchemas($fromSchema, $toSchema);
$diffSql = $diff->toSql($connection->getDatabasePlatform()); Try to run it with dbal 3.2.2 and then with dbal 3.3.3, see you the difference in |
Thanks, @marforon. I can reproduce the issue. |
So as far as I understand the code,
So as a result, you get a DDL that removes the overrides from the column in the database: ALTER TABLE test CHANGE name name VARCHAR(255) NOT NULL What exactly do you believe is wrong here? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Closing as non-reproducible. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Summary / Current behaviour / How to reproduce
I'm having issue with schema diff after upgrade from 3.2.2 to 3.3.2 (MySQL v8, not defined default_table_options or charset on dbal url connection string). Historically some of my tables were created with utf8 charset as a default and columns had a charset and collate defined as utf8mb4 somehow:
After upgrade to 3.3.2 Doctrine Migrations wants to change columns and remove charset and collate on column definition. It was fine before.
Expected behaviour
Tables created before with utf8mb3 should see columns with charset and collate as before. Only tables with utf8mb4 shouldn't declare custom charset for columns.
The text was updated successfully, but these errors were encountered: