Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-298

[GH-166] Fixes a bug caused by unquoted reserved table name being referenced during schema creation

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

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

      Url: https://github.com/doctrine/dbal/pull/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.

        Activity

        Benjamin Eberlei created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Workflow jira [ 13824 ] jira-feedback2 [ 17617 ]
        Alexander made changes -
        Status Open [ 1 ] Awaiting Testcase/Feedback [ 10000 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17617 ] jira-feedback3 [ 19973 ]
        Benjamin Eberlei made changes -
        Status Awaiting Feedback [ 10000 ] In Progress [ 3 ]
        Benjamin Eberlei made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 2.3 [ 10184 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Benjamin Eberlei
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: