[DC-536] Duplicate CREATE TABLE entries in schema.sql when using column_inheritance Created: 02/Mar/10 Updated: 18/Nov/10
|Reporter:||webPragmatist||Assignee:||Jonathan H. Wage|
MySQL 5 / PHP 5.3.1 / Symfony 1.4.3 (branch) / Doctrine 1.2.1 / Mac OSX
|Attachments:||BaseInherited.class.php BaseInheriter.class.php kerdany_10-11-18-08-30.sql kerdany_10-11-18-08-30.yml sandbox-console.txt schema.sql|
When creating a model involving column_inheritance the CREATE TABLE statement gets duplicated.
The second CREATE TABLE include an index for the keyField.
Test doctrine generated models and generated schema.sql attached.
|Comment by webPragmatist [ 02/Mar/10 ]|
It seems this issue is related to using array_unique() and databases which doctrine creates index along with the CREATE TABLE statement.
This does not occur on sqlite as shown above in the console-log.txt (this db uses the CREATE INDEX statement).
|Comment by Svetoslav Shterev [ 02/Mar/10 ]|
Yes, it seems SQL CREATE TABLE statements are generated for each of the children as well, but with sqlite, array_unique() filters out the ones that are "extra".
|Comment by Tom Boutell [ 07/May/10 ]|
We're seeing this issue too. doctrine:build --all --and-load works fine, but doctrine:build-sql generates duplicate CREATE TABLE statements. Our in-house workflow is the former, so the latter came as a surprise. Is there any sign of progress on this one?
|Comment by Sebastian Schulze [ 07/Jul/10 ]|
This looks like a Duplicate of DC-123.
|Comment by Hany el-Kerdany [ 18/Nov/10 ]|
A little addition to the symptoms of this problem.
If the one of the child classes has a foreign key to another entity, another Third Create table SQL will be created, which contains the an index on the foreign key column.
In other words, it seems that an additional create table statement is created for each automatically created index.
An illustration is in the attached yml and sql schema:
Tom Boutell: doctrine:build --all generates the problem with me!