DDC-27: schema-tool --create creates a table for a mapped superclass #34

Closed
opened 2026-01-22 12:24:57 +01:00 by admin · 7 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 1, 2009).

Jira issue originally created by user itoijala:

Using the schema-tool to create the database creates a table for a mapped superclass. I think this behaviour is not desired, since the fields of the superclass also exist in the subclass tables. Running php doctrine schema-tool --create --dump-sql --classdir="<...>" generates the following output (MySql):

CREATE TABLE Blameable (date_created DATETIME NOT NULL, date_updated DATETIME DEFAULT NULL,
date_deleted DATETIME DEFAULT NULL, creator_id INT DEFAULT NULL, updater_id INT DEFAULT NULL,
deleter_id INT DEFAULT NULL) ENGINE = InnoDB
ALTER TABLE Blameable ADD FOREIGN KEY (creator_id) REFERENCES user_users(id)
ALTER TABLE Blameable ADD FOREIGN KEY (updater_id) REFERENCES user_users(id)
ALTER TABLE Blameable ADD FOREIGN KEY (deleter_id) REFERENCES user_users(id)

Only the mapped superclass exists in the classdir. I think it should not create any tables.

Originally created by @doctrinebot on GitHub (Oct 1, 2009). Jira issue originally created by user itoijala: Using the schema-tool to create the database creates a table for a mapped superclass. I think this behaviour is not desired, since the fields of the superclass also exist in the subclass tables. Running php doctrine schema-tool --create --dump-sql --classdir="<...>" generates the following output (MySql): CREATE TABLE Blameable (date_created DATETIME NOT NULL, date_updated DATETIME DEFAULT NULL, date_deleted DATETIME DEFAULT NULL, creator_id INT DEFAULT NULL, updater_id INT DEFAULT NULL, deleter_id INT DEFAULT NULL) ENGINE = InnoDB ALTER TABLE Blameable ADD FOREIGN KEY (creator_id) REFERENCES user_users(id) ALTER TABLE Blameable ADD FOREIGN KEY (updater_id) REFERENCES user_users(id) ALTER TABLE Blameable ADD FOREIGN KEY (deleter_id) REFERENCES user_users(id) Only the mapped superclass exists in the classdir. I think it should not create any tables.
admin added the Bug label 2026-01-22 12:24:57 +01:00
admin closed this issue 2026-01-22 12:24:57 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 1, 2009):

Comment created by itoijala:

Example class, used to generate output.

@doctrinebot commented on GitHub (Oct 1, 2009): Comment created by itoijala: Example class, used to generate output.
Author
Owner

@doctrinebot commented on GitHub (Oct 1, 2009):

Comment created by romanb:

Is this with ALPHA1 or the latest code from HEAD? I remember Jon making some fixes recently for mapped superclasses.

@doctrinebot commented on GitHub (Oct 1, 2009): Comment created by romanb: Is this with ALPHA1 or the latest code from HEAD? I remember Jon making some fixes recently for mapped superclasses.
Author
Owner

@doctrinebot commented on GitHub (Oct 1, 2009):

Comment created by itoijala:

This was with ALPHA1.

@doctrinebot commented on GitHub (Oct 1, 2009): Comment created by itoijala: This was with ALPHA1.
Author
Owner

@doctrinebot commented on GitHub (Oct 3, 2009):

Comment created by @guilhermeblanco:

Are you able to try same thing with HEAD? If it works I can definately close the issue.

Cheers,

@doctrinebot commented on GitHub (Oct 3, 2009): Comment created by @guilhermeblanco: Are you able to try same thing with HEAD? If it works I can definately close the issue. Cheers,
Author
Owner

@doctrinebot commented on GitHub (Oct 3, 2009):

Comment created by itoijala:

This works now using HEAD.

No SQL is outputted with --dump-sql and no tables are created for the mapped superclass.

@doctrinebot commented on GitHub (Oct 3, 2009): Comment created by itoijala: This works now using HEAD. No SQL is outputted with --dump-sql and no tables are created for the mapped superclass.
Author
Owner

@doctrinebot commented on GitHub (Oct 3, 2009):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Oct 3, 2009): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/86351b113820609467db

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/86351b113820609467db - [10052_Example.php](https://gist.github.com/86351b113820609467db#file-10052_Example-php)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#34