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

Version20170217154604   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 66.67 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 10 10 1
A down() 10 10 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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