migrations/Version20190713134335.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 Version20190713134335 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $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');
  20.         $this->addSql('ALTER TABLE voucher_import ADD CONSTRAINT FK_5CEA68E0F639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id)');
  21.         $this->addSql('ALTER TABLE voucher ADD voucher_import_id INT DEFAULT NULL');
  22.         $this->addSql('ALTER TABLE voucher ADD CONSTRAINT FK_1392A5D82258FF05 FOREIGN KEY (voucher_import_id) REFERENCES voucher_import (id)');
  23.         $this->addSql('CREATE INDEX IDX_1392A5D82258FF05 ON voucher (voucher_import_id)');
  24.     }
  25.     public function down(Schema $schema) : void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  29.         $this->addSql('ALTER TABLE voucher DROP FOREIGN KEY FK_1392A5D82258FF05');
  30.         $this->addSql('DROP TABLE voucher_import');
  31.         $this->addSql('DROP INDEX IDX_1392A5D82258FF05 ON voucher');
  32.         $this->addSql('ALTER TABLE voucher DROP voucher_import_id');
  33.     }
  34. }