Completed
Push — master ( 0eab77...b2f729 )
by Paul
05:35
created

Version20170217154604::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
namespace Victoire\Migrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
8
/**
9
 * Auto-generated Migration: Please modify to your needs!
10
 */
11
class Version20170217154604 extends AbstractMigration
12
{
13
    /**
14
     * @param Schema $schema
15
     */
16 View Code Duplication
    public function up(Schema $schema)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
19
20
        $this->addSql('ALTER TABLE vic_view ADD CONSTRAINT FK_FAA91F341341DB46 FOREIGN KEY (entityProxy_id) REFERENCES vic_entity_proxy_new (id) ON DELETE CASCADE;');
21
        $this->addSql('ALTER TABLE vic_widget ADD CONSTRAINT FK_57DF2B232B7846BB FOREIGN KEY (related_business_entity_id) REFERENCES vic_business_entity (id) ON DELETE CASCADE;');
22
        $this->addSql('ALTER TABLE vic_widget ADD CONSTRAINT FK_57DF2B231341DB46 FOREIGN KEY (entityProxy_id) REFERENCES vic_entity_proxy_new (id) ON DELETE CASCADE;');
23
        $this->addSql('DROP TABLE vic_entity_proxy;');
24
        $this->addSql('RENAME TABLE vic_entity_proxy_new TO vic_entity_proxy;');
25
    }
26
27
    /**
28
     * @param Schema $schema
29
     */
30 View Code Duplication
    public function down(Schema $schema)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
33
34
        $this->addSql('ALTER TABLE vic_view DROP FOREIGN KEY FK_FAA91F341341DB46;');
35
        $this->addSql('ALTER TABLE vic_widget DROP FOREIGN KEY FK_57DF2B232B7846BB;');
36
        $this->addSql('ALTER TABLE vic_widget DROP FOREIGN KEY FK_57DF2B231341DB46;');
37
        $this->addSql('RENAME TABLE vic_entity_proxy TO vic_entity_proxy_new;');
38
        $this->addSql('CREATE TABLE `vic_entity_proxy` (`id` int(11) NOT NULL AUTO_INCREMENT, `article_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UNIQ_2E15B1BA7294869C` (`article_id`),  CONSTRAINT `FK_2E15B1BA7294869C` FOREIGN KEY (`article_id`) REFERENCES `vic_article` (`id`) ON DELETE CASCADE) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;');
39
    }
40
}
41