Renamed columns are not correctly detected by database schema diff
When using the default collation utf8mb4, renamed columns are not detected any more.
When you set up a new TYPO3 9.5 instance with MySQL
And rename one filed in any extensions ext_tables.sql file
I would expect to see the old field name offered to be dropped and a new field offered to be created with a new field name
What actually happens is, that database schema update does not show any changes.
Same is true for renaming an index.
[BUGFIX] Correctly create schema diff for renamed fields and indexes
TYPO3's schema migrator has code to create drop and add fields
statements out of renamed columns detected by doctrine.
This code however is never triggered, when using a MySQL connection
with tableoptions set, because then a new TableDiff object is created,
which does not contain the renamedColumns any more.
This fix tackles the issue in various places:
1. The charset is pulled out as well of the information_schema,
so that it is set in source and target schema objects and
table options stay the same for source and target schema.
2. The newly created table differences objects receive
the detected renamed columns and idexes.
Reviewed-by: Benni Mack <firstname.lastname@example.org>
Tested-by: Benni Mack <email@example.com>
Tested-by: TYPO3com <firstname.lastname@example.org>
Reviewed-by: Wouter Wolters <email@example.com>
Reviewed-by: Georg Ringer <firstname.lastname@example.org>
Tested-by: Georg Ringer <email@example.com>
#4 Updated by Helmut Hummel about 2 years ago
Christian Kuhn wrote:
confirmed. seen that, too. we had a fix related to this back in v8 times and should pick up some details from there. if that is related to utf8mb4, it's the explanation we did not see that earlier.
Would be helpful, if you could pick up the change request or ticket from back then. I didn't find anything.
otoh I'm now pretty convinced, that I found a proper fix for that.
Code was broken since 8, but was issue was leveraged with utf8mb4 transition changes.
So maybe the fix is worth backporting to 8 although the error is not that easy to trigger (if at all for column renames)