migrations/Version20210422091641.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20210422091641 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE cal_booking ADD inventory_id INT DEFAULT NULL');
  19.         $this->addSql('ALTER TABLE cal_booking ADD CONSTRAINT FK_D7A58FE19EEA759 FOREIGN KEY (inventory_id) REFERENCES cal_inventory (id)');
  20.         $this->addSql('CREATE UNIQUE INDEX UNIQ_D7A58FE19EEA759 ON cal_booking (inventory_id)');
  21.         $this->addSql('ALTER TABLE cal_inventory DROP FOREIGN KEY FK_4A4F57D7EA935B3');
  22.         $this->addSql('DROP INDEX IDX_4A4F57D7EA935B3 ON cal_inventory');
  23.         $this->addSql('ALTER TABLE cal_inventory CHANGE booking_room_id calendar_event_id INT DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE cal_inventory ADD CONSTRAINT FK_4A4F57D77495C8E3 FOREIGN KEY (calendar_event_id) REFERENCES cal_calendar_event (id)');
  25.         $this->addSql('CREATE UNIQUE INDEX UNIQ_4A4F57D77495C8E3 ON cal_inventory (calendar_event_id)');
  26.     }
  27.     public function down(Schema $schema) : void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE cal_booking DROP FOREIGN KEY FK_D7A58FE19EEA759');
  31.         $this->addSql('DROP INDEX UNIQ_D7A58FE19EEA759 ON cal_booking');
  32.         $this->addSql('ALTER TABLE cal_booking DROP inventory_id');
  33.         $this->addSql('ALTER TABLE cal_inventory DROP FOREIGN KEY FK_4A4F57D77495C8E3');
  34.         $this->addSql('DROP INDEX UNIQ_4A4F57D77495C8E3 ON cal_inventory');
  35.         $this->addSql('ALTER TABLE cal_inventory CHANGE calendar_event_id booking_room_id INT DEFAULT NULL');
  36.         $this->addSql('ALTER TABLE cal_inventory ADD CONSTRAINT FK_4A4F57D7EA935B3 FOREIGN KEY (booking_room_id) REFERENCES cal_booking_room (id)');
  37.         $this->addSql('CREATE INDEX IDX_4A4F57D7EA935B3 ON cal_inventory (booking_room_id)');
  38.     }
  39. }