Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong mysql dump generation for foreign keys #32

Closed
zerkalica opened this issue Apr 19, 2011 · 1 comment
Closed

wrong mysql dump generation for foreign keys #32

zerkalica opened this issue Apr 19, 2011 · 1 comment

Comments

@zerkalica
Copy link

Doctrine builds wrong schema for foreign keys in mysql migrations.

My entities:
/**

  • @entity
  • @table(name="Catalog_Field")
    /
    class Catalog_Model_Field
    {
    /
    *
    • @var Catalog_Model_FieldGroup
      *
    • @manytoone(targetEntity="Catalog_Model_FieldGroup")
    • @joincolumn(name="groupId", referencedColumnName="id")
      */
      private $group;
      }

/**

  • @entity
  • @table(name="Catalog_FieldGroup")
    /
    class Catalog_Model_FieldGroup
    {
    /
    *
    • Identifier.
    • @var integer
      *
    • @id @column(name="id", type="integer")
    • @GeneratedValue(strategy="IDENTITY")
      */
      private $id;
      }

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

@beberlei
Copy link
Member

Fixed for 2.0.x and 2.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants