doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.93k stars 2.52k forks source link

Joined columns not created with matching custom schema options #6823

Open NathanBaulch opened 6 years ago

NathanBaulch commented 6 years ago

I have a many-to-one join between two string fields with the MySQL collation set to ASCII. Unfortunately the join column generated by SchemaTool doesn't inherit this collation because the incorrect metadata key options is passed instead of customSchemaOptions.

Changing line 673 of SchemaTool.php to:

$columnOptions['customSchemaOptions'] = $fieldMapping['options'];

fixes the issue and the migration diff tool no longer tries to convert my ASCII fields to the default UTF-8 collation.

lcobucci commented 6 years ago

@NathanBaulch could you please send us a failing test case that reproduces that behaviour (maybe even the fix)? It would help us a lot to identify and fix the issue you're describing.

You can find examples on https://github.com/doctrine/doctrine2/tree/388afb46d0cb3ed0c51332e8df0de9e942c2690b/tests/Doctrine/Tests/ORM/Functional/Ticket

tok-88 commented 6 years ago

Anything new on this issue? @lcobucci

Ocramius commented 6 years ago

@tok-amsiq seen https://github.com/doctrine/doctrine2/commit/657a54da84765858e7e825c97faf54cfe8ff0039?

tok-88 commented 6 years ago

@Ocramius briefly yes :) But since it hadn't been reviewed, I was just curious about the progress. I have the same issue and used the columnDefinition as a solution, but if this worked it would of course be preferred.

Ocramius commented 6 years ago

@tok-amsiq if you have problems with this specific issue, please do provide a reproducible test case as suggested in https://github.com/doctrine/doctrine2/issues/6823#issuecomment-347095121

tok-88 commented 6 years ago

@Ocramius I figured @NathanBaulch already had with 657a54d, but I'll look more into it when I have the time!