[DBAL-167] Schema comparator doesn't work properly with columnDefinition's Created: 17/Sep/11 Updated: 08/Jan/15
|Component/s:||Drivers, Platforms, Schema Managers|
|Affects Version/s:||2.0.8, 2.1, 2.1.1, 2.1.2|
|Reporter:||Dmitry Strygin||Assignee:||Benjamin Eberlei|
Schema comparator will mostly always return changed properties on columns for entities defined with columnDefinition even they are identical in the DB. This is due to weak low-lever compatibility of SchemaTool#getCreateSchemaSql() and SchemaTool#getSchemaFromMetadata() – the first one doesn't reconstruct columnDefinition, and the other one never supports 'fixed', 'default', cannot determine, whether it is boolean or integer (ex. TINYINT in the DB), etc...
All this results in extremely annoying unnecessary alter-table-change-columns surrounded by dropping and after that re-enabling constrains dependent on those columns.
I mean stuff like this:
The simple solution would be to fix schema comparator not to signal any changes on columns with columnDefinition properties.
I can do this
|Comment by Roderick Schaefer | We handle IT [ 16/Oct/11 ]|
I'm having the same issue on my production webserver, but not on the development webserver. I find that odd. It tries to drop all foreign keys and create them again, although without the CHANGE statement you are referring to, Dmitry.
|Comment by Benjamin Eberlei [ 09/Jan/12 ]|
This maybe fixable by making a hash out of the column definition and saving it into a database comment.
The Foreign Key problem maybe because of an old MySQL version 5.0.x
|Comment by Joe Cai [ 16/Jul/12 ]|
@beberlei, sounds good to me. any plan of implementing this?