Skip to content

Loading…

DBAL-298: [GH-166] Fixes a bug caused by unquoted reserved table name being referenced during schema creation #1479

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of klaussilveira:

Url: #166

Message:

When creating a schema with tables with reserved names and relationships between them, the schema creation tool failed to write valid SQL in MySQL due to unquoted table names. For example:

CREATE TABLE `Group` (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL DEFAULT NULL, PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE User (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT NULL PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE UserHasGroup (user*id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_617A865CA76ED395 (user_id), INDEX IDX_617A865CFE54D947 (group_id), PRIMARY KEY(user_id, group*id)) ENGINE = InnoDB;
ALTER TABLE UserHasGroup ADD CONSTRAINT FK*617A865CA76ED395 FOREIGN KEY (user*id) REFERENCES User (id);
ALTER TABLE UserHasGroup ADD CONSTRAINT FK*617A865CFE54D947 FOREIGN KEY (group*id) REFERENCES Group (id);

This fix creates a small function for creating quoted foreign key table names.

@doctrinebot

Comment created by @beberlei:

A related Github Pull-Request [GH-166] was closed
#166

@doctrinebot

Comment created by @beberlei:

Merged

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.3 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.