Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-132

wrong mysql dump generation for foreign keys

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.0.7, 2.1.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      PHP 5.3.3-7+squeeze1 with Suhosin-Patch, Debian GNU/Linux 6.0.1 (squeeze)

      Description

      Problem in methods Doctrine\DBAL\Platforms\AbstractPlatform::getDropForeignKeySQL() and Doctrine\DBAL\Platforms\AbstractPlatform::getCreateForeignKeySQL()

      This methods do not receive FK name and don't put it in sql dump. While executing dump, mysql autogenerate FK names, but at the migration generation moment doctrine knowns nothing about them.

      I think, doctrine must generate this names and put it into the schema.

      Autogenerated migrations in mysql with fk are unusable.

      Doctrine migrations:migrate in current doctrine version:
      up:
      ALTER TABLE Catalog_Field ADD CONSTRAINT FOREIGN KEY (groupId) REFERENCES Catalog_FieldGroup(id)
      down:
      ALTER TABLE Catalog_Field DROP FOREIGN KEY

      should be:
      up:
      ALTER TABLE Catalog_Field ADD CONSTRAINT Catalog_Field_ibfk_2 FOREIGN KEY (groupId) REFERENCES Catalog_FieldGroup(id)
      down:
      ALTER TABLE Catalog_Field DROP FOREIGN KEY catalog_Field_ibfk_2

      see: https://github.com/doctrine/migrations/issues/32

      https://github.com/doctrine/migrations/issues/35

        Activity

        Stefan Zerkalica created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.7 [ 10151 ]
        Fix Version/s 2.1.1 [ 10156 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12735 ] jira-feedback2 [ 17728 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17728 ] jira-feedback3 [ 20083 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Stefan Zerkalica
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: