Project

General

Profile

Actions

Bug #56271

closed

SqlSchemaMigrationService getUpdateSuggestions creates invalid MySql statements

Added by Christian Zenker about 10 years ago. Updated about 9 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Install Tool
Target version:
-
Start date:
2014-02-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Consider an extension changes its database definition from

CREATE TABLE tx_foobar_table (
  old_uid int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (old_uid)
)
to
CREATE TABLE tx_foobar_table (
  uid int(11) NOT NULL DEFAULT '0' auto_increment,
  PRIMARY KEY (uid)
)
The statements the install tool generates for that are:
ALTER TABLE tx_realurl_redirects ADD uid int(11) NOT NULL auto_increment;
ALTER TABLE tx_realurl_redirects DROP PRIMARY KEY;
ALTER TABLE tx_realurl_redirects ADD PRIMARY KEY (uid);

The problem here is that the column definition includes the auto_increment where MySQL requires a column with auto_increment to be the Primary Key.

There is already a fix in the source code to circumvent this for newly created primary keys, but not if a primary key is changed.

Actions

Also available in: Atom PDF