<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20211115091803 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE gate_display DROP FOREIGN KEY FK_42A8A7AE897F2CF6');
$this->addSql('DROP INDEX UNIQ_42A8A7AE897F2CF6 ON gate_display');
$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');
$this->addSql('ALTER TABLE gate_display ADD CONSTRAINT FK_42A8A7AED70FE946 FOREIGN KEY (parking_slot_id) REFERENCES parkingslot (id)');
$this->addSql('ALTER TABLE gate_display ADD CONSTRAINT FK_42A8A7AEC3C6F69F FOREIGN KEY (car_id) REFERENCES car (id)');
$this->addSql('CREATE INDEX IDX_42A8A7AED70FE946 ON gate_display (parking_slot_id)');
$this->addSql('CREATE INDEX IDX_42A8A7AEC3C6F69F ON gate_display (car_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE gate_display DROP FOREIGN KEY FK_42A8A7AED70FE946');
$this->addSql('ALTER TABLE gate_display DROP FOREIGN KEY FK_42A8A7AEC3C6F69F');
$this->addSql('DROP INDEX IDX_42A8A7AED70FE946 ON gate_display');
$this->addSql('DROP INDEX IDX_42A8A7AEC3C6F69F ON gate_display');
$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`');
$this->addSql('ALTER TABLE gate_display ADD CONSTRAINT FK_42A8A7AE897F2CF6 FOREIGN KEY (gate_id) REFERENCES gate (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_42A8A7AE897F2CF6 ON gate_display (gate_id)');
}
}