Completed
Push — master ( 06fc05...42cf72 )
by Michał
12:50
created

Version20160210132042   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 7 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
namespace Sylius\Migrations;
13
14
use Doctrine\DBAL\Migrations\AbstractMigration;
15
use Doctrine\DBAL\Schema\Schema;
16
17
/**
18
 * Auto-generated Migration: Please modify to your needs!
19
 */
20
class Version20160210132042 extends AbstractMigration
21
{
22
    /**
23
     * @param Schema $schema
24
     */
25
    public function up(Schema $schema)
26
    {
27
        // this up() migration is auto-generated, please modify it to your needs
28
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
29
30
        $this->addSql('DROP TABLE sylius_promotion_order_item');
31
    }
32
33
    /**
34
     * @param Schema $schema
35
     */
36
    public function down(Schema $schema)
37
    {
38
        // this down() migration is auto-generated, please modify it to your needs
39
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
40
41
        $this->addSql('CREATE TABLE sylius_promotion_order_item (order_item_id INT NOT NULL, promotion_id INT NOT NULL, INDEX IDX_49838ED1E415FB15 (order_item_id), INDEX IDX_49838ED1139DF194 (promotion_id), PRIMARY KEY(order_item_id, promotion_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
42
        $this->addSql('ALTER TABLE sylius_promotion_order_item ADD CONSTRAINT FK_49838ED1139DF194 FOREIGN KEY (promotion_id) REFERENCES sylius_promotion (id)');
43
        $this->addSql('ALTER TABLE sylius_promotion_order_item ADD CONSTRAINT FK_49838ED1E415FB15 FOREIGN KEY (order_item_id) REFERENCES sylius_order_item (id) ON DELETE CASCADE');
44
    }
45
}
46