Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-205

MySQL SchemaManager doesn't handle composite foreign keys properly


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.5
    • Fix Version/s: 2.1.6, 2.2
    • Component/s: Schema Managers
    • Security Level: All
    • Labels:


      The MySQL SchemaManager can not properly generate a Schema from the database if a table has a foreign key that spans multiple columns.
      Therefore the comparator tries to drop the one index as individual indexes.

      That leads to an error if the resulting SQL is executed because these indexes do not exist (i.e. via app/console doctrine:schema:update --force)

      symfony2#app/console doctrine:schema:update --dump-sql
      ALTER TABLE table1 DROP FOREIGN KEY FK_C1B1712387FE737264DE5A5511B8B3E;
      DROP INDEX IDX_C1B1712387FE7372 ON table1;
      DROP INDEX IDX_C1B1712364DE5A5 ON table1;
      DROP INDEX IDX_C1B17123511B8B3E ON table1;
      ALTER TABLE table1 ADD CONSTRAINT FK_C1B1712387FE737264DE5A5511B8B3E FOREIGN KEY (column1, column2, column3) REFERENCES table2(column1, column2, column3);


        sbeining Sascha Beining created issue -
        beberlei Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.1.6 [ 10181 ]
        Fix Version/s 2.2 [ 10142 ]
        Resolution Fixed [ 1 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira [ 13375 ] jira-feedback2 [ 17782 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17782 ] jira-feedback3 [ 20137 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • 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={expand=changesets[0:20].revisions[0:29],reviews, query=DBAL-205}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)


          • Assignee:
            beberlei Benjamin Eberlei
            sbeining Sascha Beining
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: