Bug #86793

Renamed columns are not correctly detected by database schema diff

Added by Helmut Hummel 11 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-10-30
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

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.


Related issues

Related to TYPO3 Core - Feature #80398: Make default charset and collation for new tables configurable Closed 2017-03-22
Related to TYPO3 Core - Bug #78771: ConnectionMigrator does not handle renamed columns Closed 2016-11-23
Related to TYPO3 Core - Bug #81756: DatabaseSchemaComparator does not handle renamed columns New

Associated revisions

Revision 1a66bc91 (diff)
Added by Helmut Hummel 11 months ago

[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.

Releases: master
Resolves: #86793
Change-Id: Iee6bc47ccf066cf9ccd7692af34e437e57695144
Reviewed-on: https://review.typo3.org/58787
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>
Tested-by: TYPO3com <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

History

#1 Updated by Helmut Hummel 11 months ago

  • Related to Feature #80398: Make default charset and collation for new tables configurable added

#2 Updated by Christian Kuhn 11 months ago

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.

#3 Updated by Gerrit Code Review 11 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58787

#4 Updated by Helmut Hummel 11 months 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)

#5 Updated by Gerrit Code Review 11 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58787

#6 Updated by Christian Kuhn 11 months ago

  • Related to Bug #78771: ConnectionMigrator does not handle renamed columns added

#7 Updated by Christian Kuhn 11 months ago

  • Related to Bug #81756: DatabaseSchemaComparator does not handle renamed columns added

#8 Updated by Gerrit Code Review 11 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58787

#9 Updated by Helmut Hummel 11 months ago

Thanks, the related tickets and change requests helped

#10 Updated by Gerrit Code Review 11 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58787

#11 Updated by Helmut Hummel 11 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#12 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF