Failed Conditions
Push — master ( 81605b...f7b62b )
by Sam
09:20
created

Version20191218115030::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 12
rs 9.9666
ccs 0
cts 11
cp 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
9
class Version20191218115030 extends AbstractMigration
10
{
11
    public function up(Schema $schema): void
12
    {
13
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
14
15
        $this->addSql('ALTER TABLE order_line CHANGE type type ENUM(\'paper\', \'digital\') NOT NULL COMMENT \'(DC2Type:ProductType)\'');
16
        $this->addSql('ALTER TABLE product ADD type ENUM(\'paper\', \'digital\') NOT NULL COMMENT \'(DC2Type:ProductType)\'');
17
        $this->addSql('ALTER TABLE user_product CHANGE type type ENUM(\'paper\', \'digital\') NOT NULL COMMENT \'(DC2Type:ProductType)\'');
18
        $this->addSql('DROP TABLE user_product');
19
        $this->addSql('ALTER TABLE subscription CHANGE type type ENUM(\'paper\', \'digital\', \'both\') NOT NULL COMMENT \'(DC2Type:ProductType)\'');
20
        $this->addSql('ALTER TABLE user ADD subscription_last_number_id INT DEFAULT NULL, ADD subscription_begin DATETIME DEFAULT NULL, ADD subscription_type ENUM(\'paper\', \'digital\', \'both\') DEFAULT NULL COMMENT \'(DC2Type:ProductType)\', CHANGE restrict_renew_visibility web_temporary_access TINYINT(1) DEFAULT \'0\' NOT NULL');
21
        $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649D6F2FD2 FOREIGN KEY (subscription_last_number_id) REFERENCES product (id) ON DELETE SET NULL');
22
        $this->addSql('CREATE INDEX IDX_8D93D649D6F2FD2 ON user (subscription_last_number_id)');
23
    }
24
}
25