| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | public function down(Schema $schema) : void |
||
| 29 | { |
||
| 30 | // this down() migration is auto-generated, please modify it to your needs |
||
| 31 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
||
| 32 | $this->addSql('ALTER TABLE item DROP category_id;'); |
||
| 33 | $this->addSql('CREATE TABLE item_categories (item_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', category_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', PRIMARY KEY (item_id, category_id) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); |
||
| 34 | $this->addSql('ALTER TABLE item_categories ADD CONSTRAINT fk_item_categories_item_id FOREIGN KEY (item_id) REFERENCES item (id)'); |
||
| 35 | $this->addSql('ALTER TABLE item_categories ADD CONSTRAINT fk_item_categories_category_id FOREIGN KEY (category_id) REFERENCES category (id)'); |
||
| 36 | $this->addSql('ALTER TABLE item_categories ADD CONSTRAINT unique_item_category UNIQUE (item_id, category_id)'); |
||
| 37 | } |
||
| 39 |