8000 Implement the column collation for Mysql by mikeSimonson · Pull Request #2551 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement the column collation for Mysql #2551

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

Closed
wants to merge 2 commits into from

Conversation

mikeSimonson
Copy link
Contributor

Related to #2538

@Ocramius
Copy link
Member
Ocramius commented Nov 6, 2016

@mikeSimonson should this fix (since it fixes #2538, if I understand it correctly) come with a test case then?

@mikeSimonson
Copy link
Contributor Author

@Ocramius Do you mean that the test should be removed or that it needs a higher level test case ?

@Ocramius
Copy link
Member

@mikeSimonson higher level test case reflecting #2538

@mikeSimonson
Copy link
Contributor Author

@Ocramius What is the right approach here for the test ?

Copy link
Member
@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

One last change probably needed: verifying that the comparator will pick up the collation (unless that is already covered)

/**
* https://github.com/doctrine/dbal/issues/2538
*/
public function testFixGithub2538_autoincrement()
Copy link
Member

Choose a reason for hiding this comment

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

This test seems unrelated to the changes, or am I missing something?

Copy link
Member

Choose a reason for hiding this comment

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

Please use a method name describing the issue being covered. Also, use @group #2538 for labeling it

{
$this->markTestSkipped();

$tableName = "public.foo";
Copy link
Member

Choose a reason for hiding this comment

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

Single quotes

/**
* https://github.com/doctrine/dbal/issues/2538
*/
public function testFixGithub2538Collation()
Copy link
Member

Choose a reason for hiding this comment

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

Please use a method name describing the issue being covered. Also, use @group #2538 for labeling it

@@ -1429,4 +1429,18 @@ public function getGeneratesFloatDeclarationSQL()
array(array('precision' => 8, 'scale' => 2), 'DOUBLE PRECISION'),
);
}

public function testFixGithub2538Collation()
Copy link
Member

Choose a reason for hiding this comment

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

Please use a method name describing the issue being covered. Also, use @group #2538 for labeling it

@yukoff
Copy link
yukoff commented Jul 23, 2017

What is the progress with this one? And maybe there should be column charset implemented as well?

@Tobion
Copy link
Contributor
Tobion commented Aug 3, 2017

I don't see the point of this PR. Column collations are working in mysql already in general.

@ORM\Column(type="string", options={"collation"="ascii_general_ci"}) will correctly generate a mysql column like myfield VARCHAR(255) NOT NULL COLLATE ascii_general_ci

The requested change seems useless. MysqlPlatform already implements

public function supportsColumnCollation()
{
        return true;
}

and the rest is handled by the default implementation of AbstractPlatform.

There are two bugs with column collations:

  1. schema update / migrations doesn't recognize collation changes, see Detect changes on the column collation (Issue #2400) #2401 similar issues
  2. When you have a column collation overwritten for an enity primary key that is used as forgeign key in another entity, then the collation is MISSING in the foreign key definition. This makes the generated schema invalid because the collations can be different which is not allowed in foreign key constraints. This is what is stumbled upon. I'll create an issue for this.

@Ocramius
Copy link
Member
Ocramius commented Aug 3, 2017

Column collations are working in mysql already in general.

Tests seem to say otherwise, but feel free to provide more tests or comment on the ones provided in this PR.

@Ocramius Ocramius added this to the 2.7.0 milestone Mar 30, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0