Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
11 | public function up(Schema $schema): void |
||
12 | { |
||
13 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
||
14 | |||
15 | $this->addSql('ALTER TABLE booking ADD bookable_id INT DEFAULT NULL'); |
||
16 | $this->addSql('UPDATE booking JOIN booking_bookable ON booking_bookable.booking_id = booking.id SET booking.bookable_id = booking_bookable.bookable_id'); |
||
17 | $this->addSql('ALTER TABLE booking ADD CONSTRAINT FK_E00CEDDEEC4F5B2F FOREIGN KEY (bookable_id) REFERENCES bookable (id) ON DELETE CASCADE'); |
||
18 | $this->addSql('CREATE INDEX IDX_E00CEDDEEC4F5B2F ON booking (bookable_id)'); |
||
19 | $this->addSql('DROP TABLE booking_bookable'); |
||
20 | } |
||
22 |