Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

wrong mysql dump generation for foreign keys #32

Closed
zerkalica opened this Issue · 1 comment

2 participants

@zerkalica

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
Owner

Fixed for 2.0.x and 2.1.x

@beberlei beberlei 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.