Bug #78771

ConnectionMigrator does not handle renamed columns

Added by Stefan Froemken over 4 years ago. Updated almost 3 years ago.

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

100%

Estimated time:
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 diffClosed2018-10-30

Actions
Precedes TYPO3 Core - Bug #81756: DatabaseSchemaComparator does not handle renamed columnsClosed

Actions
#1

Updated by Christian Kuhn over 4 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 over 4 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 over 4 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 over 4 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 over 4 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 over 4 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 over 4 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 over 4 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 over 4 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 over 4 years ago

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

Updated by Robert Vock about 4 years ago

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

Updated by Benni Mack almost 3 years ago

  • Status changed from Resolved to Closed
#13

Updated by Christian Kuhn over 2 years ago

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

Also available in: Atom PDF