[DBAL-126] schema-tool creates primary keys as unique constraints Created: 09/Jun/11 Updated: 26/Jun/11 Resolved: 26/Jun/11
|Fix Version/s:||2.0.7, 2.1|
The schema tool calls AbstractPlatform::getCreateIndexSQL() to create new indexes. When the index is primary, this creates a unique key instead.
|Comment by Karsten Dambekalns [ 25/Jun/11 ]|
While the description here is very sparse, I think it is about the following problem.
When a primary key is to be created for MySQL, the statement generated is
ADD UNIQUE INDEX PRIMARY ON foo (bar)
This fails with MySQL stating primary is an invalid name. Since "ADD INDEX" is mapped to "ALTER TABLE" anyway, I just made that
ALTER TABLE foo ADD PRIMARY KEY (bar)
which works fine. Also
DROP INDEX primary ON foo
doesn't work, unless I quote primary (since it is a reserved word), but there
ALTER TABLE foo DROP PRIMARY KEY
seems better as well.
|Comment by Benjamin Eberlei [ 26/Jun/11 ]|