<?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 Version20210805110633 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 reservation_history ADD parking_slot_id INT NOT NULL, ADD car_id INT DEFAULT NULL, ADD visitation_id INT DEFAULT NULL, ADD plate LONGTEXT NOT NULL, ADD state LONGTEXT NOT NULL, DROP made_alert, CHANGE reservation_id reservation_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE reservation_history ADD CONSTRAINT FK_402FCBCED70FE946 FOREIGN KEY (parking_slot_id) REFERENCES parkingslot (id)');
$this->addSql('ALTER TABLE reservation_history ADD CONSTRAINT FK_402FCBCEC3C6F69F FOREIGN KEY (car_id) REFERENCES car (id)');
$this->addSql('ALTER TABLE reservation_history ADD CONSTRAINT FK_402FCBCE35E54CD2 FOREIGN KEY (visitation_id) REFERENCES visitation (id)');
$this->addSql('CREATE INDEX IDX_402FCBCED70FE946 ON reservation_history (parking_slot_id)');
$this->addSql('CREATE INDEX IDX_402FCBCEC3C6F69F ON reservation_history (car_id)');
$this->addSql('CREATE INDEX IDX_402FCBCE35E54CD2 ON reservation_history (visitation_id)');
$this->addSql('ALTER TABLE user CHANGE authtype_id authtype_id INT DEFAULT 1');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE reservation_history DROP FOREIGN KEY FK_402FCBCED70FE946');
$this->addSql('ALTER TABLE reservation_history DROP FOREIGN KEY FK_402FCBCEC3C6F69F');
$this->addSql('ALTER TABLE reservation_history DROP FOREIGN KEY FK_402FCBCE35E54CD2');
$this->addSql('DROP INDEX IDX_402FCBCED70FE946 ON reservation_history');
$this->addSql('DROP INDEX IDX_402FCBCEC3C6F69F ON reservation_history');
$this->addSql('DROP INDEX IDX_402FCBCE35E54CD2 ON reservation_history');
$this->addSql('ALTER TABLE reservation_history ADD made_alert TINYINT(1) NOT NULL, DROP parking_slot_id, DROP car_id, DROP visitation_id, DROP plate, DROP state, CHANGE reservation_id reservation_id INT NOT NULL');
$this->addSql('ALTER TABLE user CHANGE authtype_id authtype_id INT DEFAULT NULL');
}
}