Use the doctrine schema comparator to correctly determine the table diff#252
Use the doctrine schema comparator to correctly determine the table diff#252acrobat wants to merge 1 commit intoDamienHarper:masterfrom
Conversation
|
@acrobat thanks for the contribution but most of the tests fail. I can't merge this PR as is. |
|
@DamienHarper do you have any pointers on how to debug this test failure? I can't reproduce this locally, either with the in memory sqllite or mysql db Full testsuite: and the specific failing test file only (with testdox output) |
|
@acrobat you can run |
|
Thanks! My bad I was also running them on the wrong branch, so I'm able to reproduce now! The test failure comes from this "funky" test code that uses reflection to calculate the diff, this bypasses the table re-assign if there are changes. But I'm not sure how to rewrite the test as it should be based on real entity changes 🤔 auditor/tests/Provider/Doctrine/Persistence/Schema/SchemaManagerTest.php Lines 237 to 243 in 44d6d35 |
The default charset and collation are not present in the options array of the new columns and by just removing and re-adding the columns this change in the diff is lost thus generating equal alter table queries.
I've switched to the doctrine schema comparator to check for actual differences between the two table. This way it doesn't generate any sql the table stays the same.
Before change:
After change:
Fixes DamienHarper/auditor-bundle#553
Possibly fixes #241 also (to be tested as I don't use postgres in my project)