<?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 Version20200311001044 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_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');
$this->addSql('ALTER TABLE voucher_store_email_template ADD CONSTRAINT FK_FD50FC002E35F098 FOREIGN KEY (voucher_store_id) REFERENCES voucher_store (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE voucher_store_email_template ADD CONSTRAINT FK_FD50FC00131A730F FOREIGN KEY (email_template_id) REFERENCES email_template (id) ON DELETE CASCADE');
$this->addSql("INSERT INTO email_template (recipient, subject, template, name) VALUES "
." ('{{purchase.delivery}}', 'Your {{purchase.campaign.name}} voucher', '<p>Congratulations!</p>\r\n\r\n"
."<p>You just recived \"{{purchase.campaign.name}}\" voucher with the value of £{{ purchase.voucher.campaign.discountAbsolute|number_format(2, \\'.\\', \\',\\') }}</p>"
."\r\n\r\n<p>Your voucher code is:</p>\r\n\r\n<h2>{{purchase.voucher.code }}</h2>', 'Voucher Purchase')");
}
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('DROP TABLE voucher_store_email_template');
}
}