Bug #78771

ConnectionMigrator does not handle renamed columns

Added by Stefan Froemken almost 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2016-11-23
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Hello Core-Team,

in our extension events2 I have renamed the column "events" to "event", but "Database analyzer" can not detect that change. So currently I have to rename that column on my own on DB directly.

SchemaDiff class of Doctrine DBAL compares the arrays of addedColumns against removedColumns. If some Options are the same the SchemaDiff class moves that difference to renamedColumns and DELETEs the entries from addedColumns and removedColumns.

In ConnectionManager you only collect the values of addedColumns (Method: getNewFieldUpdateSuggestions) and removedColumns (Method: getUnusedFieldUpdateSuggestions), but there is no check against renamedColumns.

In the meanwhile I have 12 tables incl. some TYPO3 tables like sys_file_metadata and pages which could not be migrated because of renamedColumns.

Stefan


Related issues

Related to TYPO3 Core - Bug #86793: Renamed columns are not correctly detected by database schema diff Closed 2018-10-30
Precedes TYPO3 Core - Bug #81756: DatabaseSchemaComparator does not handle renamed columns New

Associated revisions

Revision e3779b1f (diff)
Added by Morton Jonuschat almost 3 years ago

[BUGFIX] InstallTool: handle column renames in database compare

When the Doctrine SchemaMigrator detects an added column and a removed
column that only differ by name but not by configuration these separate
changes get optimized into a column rename operation.

Deoptimize these renames into distinct add/drop column operations to
keep handling of columns consistent when multiple columns change at the
same time.

Resolves: #78771
Releases: master
Change-Id: Ic6d06b99dfb3f33975969be39d904faac5b438a0
Reviewed-on: https://review.typo3.org/51085
Tested-by: TYPO3com <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Christian Kuhn almost 3 years ago

Stefan, I think that's not possible. The schema analyzer compares definition (ext_tables) with current db state, but it does not compare a "previous" definition with definition "now". There is no other state.

Saying "hey, you want to have field 'event', it is not in db, but i found a similar field 'events' let's use that instead" is guess work that will immediately fail.

What you want / need is migration. This needs a concept anyway.

#2 Updated by Christian Kuhn almost 3 years ago

tend to close that issue. renaming / migration is not task of the db analyzer. Or do i misunderstand your issue?

#3 Updated by Christian Kuhn almost 3 years ago

Ok, slightly misunderstood this issue. The problem is that fields which are detected by doctrine as "rename" are NOT added later, so those fields are missing and can not be added by install tool schema analyzer. this is clearly a bug that needs to be fixed.

however, i think, we must NOT use the renaming functionality of doctrine, but switch those suggestions to add instead, or disable the rename integration.

#4 Updated by Gerrit Code Review almost 3 years 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/50764

#5 Updated by Gerrit Code Review almost 3 years ago

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/51085

#6 Updated by Gerrit Code Review almost 3 years 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/51085

#7 Updated by Gerrit Code Review almost 3 years 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/51085

#8 Updated by Gerrit Code Review almost 3 years 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/51085

#9 Updated by Gerrit Code Review almost 3 years ago

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

#10 Updated by Morton Jonuschat almost 3 years ago

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

#11 Updated by Robert Vock over 2 years ago

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

#12 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

#13 Updated by Christian Kuhn about 1 year ago

  • Related to Bug #86793: Renamed columns are not correctly detected by database schema diff added

Also available in: Atom PDF