<?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 Version20190713134335 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 voucher_import (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, memo VARCHAR(255) DEFAULT NULL, INDEX IDX_5CEA68E0F639F774 (campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE voucher_import ADD CONSTRAINT FK_5CEA68E0F639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id)');
$this->addSql('ALTER TABLE voucher ADD voucher_import_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE voucher ADD CONSTRAINT FK_1392A5D82258FF05 FOREIGN KEY (voucher_import_id) REFERENCES voucher_import (id)');
$this->addSql('CREATE INDEX IDX_1392A5D82258FF05 ON voucher (voucher_import_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 voucher DROP FOREIGN KEY FK_1392A5D82258FF05');
$this->addSql('DROP TABLE voucher_import');
$this->addSql('DROP INDEX IDX_1392A5D82258FF05 ON voucher');
$this->addSql('ALTER TABLE voucher DROP voucher_import_id');
}
}