Completed
Push — master ( 52cd2c...047880 )
by Kamil
47:26 queued 26:32
created

Version20200110132702   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 9 1
A down() 0 9 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sylius\Migrations;
15
16
use Doctrine\DBAL\Schema\Schema;
17
use Doctrine\Migrations\AbstractMigration;
18
19
final class Version20200110132702 extends AbstractMigration
20
{
21
    public function up(Schema $schema): void
22
    {
23
        // this up() migration is auto-generated, please modify it to your needs
24
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
25
26
        $this->addSql('ALTER TABLE sylius_channel ADD menu_taxon_id INT DEFAULT NULL');
27
        $this->addSql('ALTER TABLE sylius_channel ADD CONSTRAINT FK_16C8119EF242B1E6 FOREIGN KEY (menu_taxon_id) REFERENCES sylius_taxon (id) ON DELETE SET NULL');
28
        $this->addSql('CREATE INDEX IDX_16C8119EF242B1E6 ON sylius_channel (menu_taxon_id)');
29
    }
30
31
    public function down(Schema $schema): void
32
    {
33
        // this down() migration is auto-generated, please modify it to your needs
34
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
35
36
        $this->addSql('ALTER TABLE sylius_channel DROP FOREIGN KEY FK_16C8119EF242B1E6');
37
        $this->addSql('DROP INDEX IDX_16C8119EF242B1E6 ON sylius_channel');
38
        $this->addSql('ALTER TABLE sylius_channel DROP menu_taxon_id');
39
    }
40
}
41