migrations\Version20211115091803.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 Version20211115091803 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 gate_display DROP FOREIGN KEY FK_42A8A7AE897F2CF6');
  19.         $this->addSql('DROP INDEX UNIQ_42A8A7AE897F2CF6 ON gate_display');
  20.         $this->addSql('ALTER TABLE gate_display ADD car_id INT NOT NULL, ADD display_id varchar(5) DEFAULT "1" NOT NULL, ADD `from` DATETIME NOT NULL, ADD `to` DATETIME NOT NULL, CHANGE gate_id parking_slot_id INT NOT NULL');
  21.         $this->addSql('ALTER TABLE gate_display ADD CONSTRAINT FK_42A8A7AED70FE946 FOREIGN KEY (parking_slot_id) REFERENCES parkingslot (id)');
  22.         $this->addSql('ALTER TABLE gate_display ADD CONSTRAINT FK_42A8A7AEC3C6F69F FOREIGN KEY (car_id) REFERENCES car (id)');
  23.         $this->addSql('CREATE INDEX IDX_42A8A7AED70FE946 ON gate_display (parking_slot_id)');
  24.         $this->addSql('CREATE INDEX IDX_42A8A7AEC3C6F69F ON gate_display (car_id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE gate_display DROP FOREIGN KEY FK_42A8A7AED70FE946');
  30.         $this->addSql('ALTER TABLE gate_display DROP FOREIGN KEY FK_42A8A7AEC3C6F69F');
  31.         $this->addSql('DROP INDEX IDX_42A8A7AED70FE946 ON gate_display');
  32.         $this->addSql('DROP INDEX IDX_42A8A7AEC3C6F69F ON gate_display');
  33.         $this->addSql('ALTER TABLE gate_display ADD gate_id INT NOT NULL, DROP parking_slot_id, DROP car_id, DROP display_id, DROP `from`, DROP `to`');
  34.         $this->addSql('ALTER TABLE gate_display ADD CONSTRAINT FK_42A8A7AE897F2CF6 FOREIGN KEY (gate_id) REFERENCES gate (id)');
  35.         $this->addSql('CREATE UNIQUE INDEX UNIQ_42A8A7AE897F2CF6 ON gate_display (gate_id)');
  36.     }
  37. }