[BUGFIX] InstallTool: Optimize ALTER TABLE for auto_increment columns
To successfully add a new column with auto_increment enabled to a table the column needs to be included in a (primary) key. The install tool handled this in a two step process by ignoring the auto_increment attribute and separating adding the field and the key into two statements. This fails on existing tables with data as the column will include non-uniqued/non-incrementing values after the first statement leading to failures adding the key. The proper way to add a columns with the auto_increment attribute is to combine the ALTER TABLE statement to perform both alterations at the same time, this patch changes the behavior of the Install Tool to generate statements accordingly on MySQL. When running with DBAL enabled the statement will not be altered in any way to allow the SqlParser to take into account database specific handling of this case, an example test case is included for PostgreSQL which handles this case transparently using the SERIAL column type. Resolves: #69304 Releases: master, 6.2 Change-Id: I211b25b22e122e47d289b9d7f927b5c713cdd138 Reviewed-on: http://review.typo3.org/42902 Reviewed-by:Morton Jonuschat <m.jonuschat@mojocode.de> Tested-by:
Morton Jonuschat <m.jonuschat@mojocode.de> Reviewed-by:
Nicole Cordes <typo3@cordes.co> Tested-by:
Nicole Cordes <typo3@cordes.co>
Showing
- typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionPostgresqlTest.php 14 additions, 0 deletions.../Tests/Unit/Database/DatabaseConnectionPostgresqlTest.php
- typo3/sysext/install/Classes/Service/SqlSchemaMigrationService.php 6 additions, 3 deletions...ext/install/Classes/Service/SqlSchemaMigrationService.php
Please register or sign in to comment