Details
Description
A recent update broke all support for STI.
Now the following does not work:
/**
* @MappedSuperclass
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="type", type="string")
* @DiscriminatorMap({"User" = "User", "Group" = "Group"})
* @Table(name="user")
*/
abstract class Principal
{}
/**
* @Entity
*/
class Group extends Principal
{}
/**
* @Entity
*/
class User extends Principal
{}
Attempting to use orm:schema-tool:create results in the following error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Group (user_id INT NOT NULL, username VARCHAR(45) NOT NULL, password VARCHAR(40)' at line 1
The SQL generated is:
CREATE TABLE Group (user_id INT NOT NULL, username VARCHAR(45) NOT NULL, password VARCHAR(40) NOT NULL, status SMALLINT NOT NULL, firstname VARCHAR(45) NOT NULL, lastname VARCHAR(45) NOT NULL, email VARCHAR(60) NOT NULL, phone VARCHAR(20) DEFAULT NULL, pager VARCHAR(20) DEFAULT NULL, reset_code VARCHAR(6) DEFAULT NULL, is_password_expired TINYINT(1) NOT NULL, failed_login_count SMALLINT NOT NULL, is_admin TINYINT(1) NOT NULL, version INT DEFAULT 1 NOT NULL, UNIQUE INDEX Group_username_uniq (username), PRIMARY KEY(user_id)) ENGINE = InnoDB;
CREATE TABLE User (user_id INT NOT NULL, username VARCHAR(45) NOT NULL, password VARCHAR(40) NOT NULL, status SMALLINT NOT NULL, firstname VARCHAR(45) NOT NULL, lastname VARCHAR(45) NOT NULL, email VARCHAR(60) NOT NULL, phone VARCHAR(20) DEFAULT NULL, pager VARCHAR(20) DEFAULT NULL, reset_code VARCHAR(6) DEFAULT NULL, is_password_expired TINYINT(1) NOT NULL, failed_login_count SMALLINT NOT NULL, is_admin TINYINT(1) NOT NULL, version INT DEFAULT 1 NOT NULL, UNIQUE INDEX User_username_uniq (username), PRIMARY KEY(user_id)) ENGINE = InnoDB;
Issue Links
- relates to
-
DDC-477
Schema tool does not support STI - attempts duplicate table creation
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Affects Version/s | 2.0-BETA1 [ 10030 ] | |
| Component/s | Tools [ 10015 ] |
| Assignee | Roman S. Borschel [ romanb ] | Benjamin Eberlei [ beberlei ] |
| Fix Version/s | 2.0-BETA1 [ 10030 ] |
| Assignee | Benjamin Eberlei [ beberlei ] | Roman S. Borschel [ romanb ] |
| Fix Version/s | 2.0-BETA2 [ 10050 ] | |
| Fix Version/s | 2.0-BETA1 [ 10030 ] |
| Fix Version/s | 2.0-BETA3 [ 10060 ] | |
| Fix Version/s | 2.0-BETA2 [ 10050 ] |
| Fix Version/s | 2.0-BETA4 [ 10072 ] | |
| Fix Version/s | 2.0-BETA3 [ 10060 ] |
| Priority | Critical [ 2 ] | Major [ 3 ] |
| Fix Version/s | 2.0-RC1 [ 10091 ] | |
| Fix Version/s | 2.0-BETA4 [ 10072 ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Roman S. Borschel [ romanb ] | Benjamin Eberlei [ beberlei ] |
| Resolution | Fixed [ 1 ] |
| Workflow | jira [ 11207 ] | jira-feedback [ 14383 ] |
| Workflow | jira-feedback [ 14383 ] | jira-feedback2 [ 16247 ] |
| Workflow | jira-feedback2 [ 16247 ] | jira-feedback3 [ 18500 ] |
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-511, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
That seems to be a reserved keyword issues.
I see comments around the STI issues, but this one doesn't seem to be the case.
Try to use a different table name:
@Table(name="groups")and...
@Table(name="users")This should fix the issue.
Cheers,