Skip to content
Snippets Groups Projects
Commit 859a905c authored by Morton Jonuschat's avatar Morton Jonuschat Committed by Nicole Cordes
Browse files

[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: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: default avatarNicole Cordes <typo3@cordes.co>
Tested-by: default avatarNicole Cordes <typo3@cordes.co>
parent cdfd83fe
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment