Bug #78771
closed
ConnectionMigrator does not handle renamed columns
Added by Stefan Froemken almost 8 years ago.
Updated about 6 years ago.
Category:
Database API (Doctrine DBAL)
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
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.
tend to close that issue. renaming / migration is not task of the db analyzer. Or do i misunderstand your issue?
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.
- Status changed from New to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Precedes Bug #81756: DatabaseSchemaComparator does not handle renamed columns added
- Status changed from Resolved to Closed
- Related to Bug #86793: Renamed columns are not correctly detected by database schema diff added
Also available in: Atom
PDF