Passed
Pull Request — master (#83)
by
unknown
06:17
created

Version20201021101147::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitBag\SyliusMolliePlugin\Migrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
final class Version20201021101147 extends AbstractMigration
11
{
12
    public function getDescription(): string
13
    {
14
        return '';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        // this up() migration is auto-generated, please modify it to your needs
20
        $this->addSql('CREATE TABLE bitbag_mollie_email_template (id INT AUTO_INCREMENT NOT NULL, type VARCHAR(255) NOT NULL, style TEXT DEFAULT NULL, UNIQUE INDEX UNIQ_835AAD848CDE5729 (type), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE `UTF8_unicode_ci` ENGINE = InnoDB');
21
        $this->addSql('CREATE TABLE bitbag_mollie_email_template_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, subject VARCHAR(255) DEFAULT NULL, content TEXT DEFAULT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_42127E4A2C2AC5D3 (translatable_id), UNIQUE INDEX bitbag_mollie_email_template_translation_uniq_trans (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE `UTF8_unicode_ci` ENGINE = InnoDB');
22
        $this->addSql('ALTER TABLE bitbag_mollie_email_template_translation ADD CONSTRAINT FK_42127E4A2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES bitbag_mollie_email_template (id) ON DELETE CASCADE');
23
        $this->addSql('ALTER TABLE sylius_order CHANGE abandoned_email abandonedEmail TINYINT(1) NOT NULL');
24
    }
25
26
    public function down(Schema $schema): void
27
    {
28
        // this down() migration is auto-generated, please modify it to your needs
29
        $this->addSql('ALTER TABLE bitbag_mollie_email_template_translation DROP FOREIGN KEY FK_42127E4A2C2AC5D3');
30
        $this->addSql('DROP TABLE bitbag_mollie_email_template');
31
        $this->addSql('DROP TABLE bitbag_mollie_email_template_translation');
32
        $this->addSql('ALTER TABLE sylius_order CHANGE abandonedemail abandoned_email TINYINT(1) NOT NULL');
33
    }
34
}
35