Skip to content
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

Add support for collation option to MySQL #5246

Merged
merged 1 commit into from
Feb 5, 2022

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented Feb 5, 2022

Our documentation advertises it:
https://www.doctrine-project.org/projects/doctrine-dbal/en/3.3.1/reference/schema-representation.html
The option collate stays supported and should be deprecated in 3.4

Fixes #5214
Fixes #5243

Our documentation advertises it:
https://www.doctrine-project.org/projects/doctrine-dbal/en/3.3.1/reference/schema-representation.html
The option "collate" stays supported and should be deprecated in 3.4
@greg0ire greg0ire added the Bug label Feb 5, 2022
'my_collation',
$this->platform->getCreateTableSQL($table)[0]
);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although both tests look a lot like each other, I elected not to use a data provider here, as the second test should diverge in 3.4 because of the deprecation.

@greg0ire greg0ire requested a review from morozov February 5, 2022 12:23
@greg0ire
Copy link
Member Author

greg0ire commented Feb 5, 2022

@mlocati please review

// Collate
if (! isset($options['collate'])) {
$options['collate'] = $options['charset'] . '_unicode_ci';
if (isset($options['collate'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the collate and collation keys are both defined, here collate takes the precedence over collation.
If we want to deprecate collate in favor of collation I'd do the opposite.

Copy link
Member Author

@greg0ire greg0ire Feb 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should instead throw if both are defined? Or if both are defined but different? I don't think that it would make sense to have both defined but different. Having both defined but the same might make sense in situation where you want to support 2 versions of DBAL (me might want to do so in DoctrineBundle).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of throwing if they are different. It would also be nice to trigger a deprecation warning if collate is defined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd refrain from throwing new exceptions and triggering deprecations in a patch release. It's also fine that "collate" takes precedence thereby providing less disruption during the upgrade.

@morozov morozov added this to the 3.3.2 milestone Feb 5, 2022
@greg0ire greg0ire merged commit 35eae23 into doctrine:3.3.x Feb 5, 2022
@greg0ire greg0ire deleted the support-for-collate branch February 5, 2022 16:33
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants