<?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 Version20200121135123 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE reason (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, state VARCHAR(255) NOT NULL COMMENT \'(DC2Type:setting_type_enum)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE ebooking ADD last_reason_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE ebooking ADD CONSTRAINT FK_804943164E74CA94 FOREIGN KEY (last_reason_id) REFERENCES reason (id)');
$this->addSql('CREATE INDEX IDX_804943164E74CA94 ON ebooking (last_reason_id)');
$this->addSql('ALTER TABLE booking ADD last_reason_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE booking ADD CONSTRAINT FK_E00CEDDE4E74CA94 FOREIGN KEY (last_reason_id) REFERENCES reason (id)');
$this->addSql('CREATE INDEX IDX_E00CEDDE4E74CA94 ON booking (last_reason_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE ebooking DROP FOREIGN KEY FK_804943164E74CA94');
$this->addSql('ALTER TABLE booking DROP FOREIGN KEY FK_E00CEDDE4E74CA94');
$this->addSql('DROP TABLE reason');
$this->addSql('DROP INDEX IDX_E00CEDDE4E74CA94 ON booking');
$this->addSql('ALTER TABLE booking DROP last_reason_id');
$this->addSql('DROP INDEX IDX_804943164E74CA94 ON ebooking');
$this->addSql('ALTER TABLE ebooking DROP last_reason_id');
}
}