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

Version20200218165716   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 12
ccs 0
cts 9
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 10 1
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