migrations/Version20200311001044.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 Version20200311001044 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_store_email_template (voucher_store_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', email_template_id INT NOT NULL, INDEX IDX_FD50FC002E35F098 (voucher_store_id), INDEX IDX_FD50FC00131A730F (email_template_id), PRIMARY KEY(voucher_store_id, email_template_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE voucher_store_email_template ADD CONSTRAINT FK_FD50FC002E35F098 FOREIGN KEY (voucher_store_id) REFERENCES voucher_store (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE voucher_store_email_template ADD CONSTRAINT FK_FD50FC00131A730F FOREIGN KEY (email_template_id) REFERENCES email_template (id) ON DELETE CASCADE');
  22.         $this->addSql("INSERT INTO email_template (recipient, subject, template, name) VALUES "
  23.             ." ('{{purchase.delivery}}',    'Your {{purchase.campaign.name}} voucher', '<p>Congratulations!</p>\r\n\r\n"
  24.             ."<p>You just recived \"{{purchase.campaign.name}}\" voucher with the value of £{{ purchase.voucher.campaign.discountAbsolute|number_format(2, \\'.\\', \\',\\') }}</p>"
  25.             ."\r\n\r\n<p>Your voucher code is:</p>\r\n\r\n<h2>{{purchase.voucher.code }}</h2>',    'Voucher Purchase')");
  26.     }
  27.     public function down(Schema $schema) : void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  31.         $this->addSql('DROP TABLE voucher_store_email_template');
  32.     }
  33. }