| Total Complexity | 2 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Version20121024115954 extends AbstractMigration |
||
| 12 | { |
||
| 13 | public function up(Schema $schema) |
||
| 14 | { |
||
| 15 | // this up() migration is autogenerated, please modify it to your needs |
||
| 16 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); |
||
| 17 | $this->addSql("ALTER TABLE event__events_sponsors DROP PRIMARY KEY"); |
||
| 18 | $this->addSql("ALTER TABLE event__events_sponsors ADD id INT NOT NULL AUTO_INCREMENT FIRST, ADD category_id INT DEFAULT NULL, CHANGE sponsor_id sponsor_id INT DEFAULT NULL, CHANGE event_id event_id INT DEFAULT NULL, ADD PRIMARY KEY (id)"); |
||
| 19 | $this->addSql("ALTER TABLE event__events_sponsors ADD CONSTRAINT FK_3CCEC92812469DE2 FOREIGN KEY (category_id) REFERENCES sponsors_category (id)"); |
||
| 20 | $this->addSql("CREATE INDEX IDX_3CCEC92812469DE2 ON event__events_sponsors (category_id)"); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function down(Schema $schema) |
||
| 24 | { |
||
| 25 | // this down() migration is autogenerated, please modify it to your needs |
||
| 26 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); |
||
| 27 | |||
| 28 | $this->addSql("ALTER TABLE event__events_sponsors DROP FOREIGN KEY FK_3CCEC92812469DE2"); |
||
| 29 | $this->addSql("DROP INDEX IDX_3CCEC92812469DE2 ON event__events_sponsors"); |
||
| 30 | $this->addSql("ALTER TABLE event__events_sponsors DROP id, DROP category_id, CHANGE sponsor_id sponsor_id INT NOT NULL, CHANGE event_id event_id INT NOT NULL"); |
||
| 31 | $this->addSql("ALTER TABLE event__events_sponsors ADD PRIMARY KEY (sponsor_id, event_id)"); |
||
| 32 | } |
||
| 34 |