Failed Conditions
Push — master ( 8cb271...90b6d5 )
by Sam
08:31
created

Version20200218165716::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 10
ccs 0
cts 9
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
9
class Version20200218165716 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 subscription ADD illustration_id INT DEFAULT NULL');
16
        $this->addSql('ALTER TABLE subscription ADD CONSTRAINT FK_A3C664D35926566C FOREIGN KEY (illustration_id) REFERENCES image (id) ON DELETE CASCADE');
17
        $this->addSql('CREATE UNIQUE INDEX UNIQ_A3C664D35926566C ON subscription (illustration_id)');
18
        $this->addSql('ALTER TABLE product ADD illustration_id INT DEFAULT NULL');
19
        $this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD5926566C FOREIGN KEY (illustration_id) REFERENCES image (id) ON DELETE CASCADE');
20
        $this->addSql('CREATE UNIQUE INDEX UNIQ_D34A04AD5926566C ON product (illustration_id)');
21
    }
22
}
23