Completed
Pull Request — master (#136)
by
unknown
12:44
created

Version20170330115601   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 78.26 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 18 18 1
A down() 18 18 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 Application\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 Version20170330115601 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 up() migration is auto-generated, please modify it to your needs
19
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
20
21
        $this->addSql('ALTER TABLE price_category DROP FOREIGN KEY FK_64FA22D640A73EBA');
22
        $this->addSql('DROP INDEX IDX_64FA22D640A73EBA ON price_category');
23
        $this->addSql('ALTER TABLE price_category ADD places VARCHAR(255) NOT NULL, ADD price INT NOT NULL, ADD venueSector_id INT DEFAULT NULL, CHANGE color color VARCHAR(255) DEFAULT \'grey\' NOT NULL, CHANGE title rows VARCHAR(255) NOT NULL, CHANGE venue_id performanceEvent_id INT DEFAULT NULL');
24
        $this->addSql('ALTER TABLE price_category ADD CONSTRAINT FK_64FA22D65F1583FA FOREIGN KEY (performanceEvent_id) REFERENCES performance_schedule (id)');
25
        $this->addSql('ALTER TABLE price_category ADD CONSTRAINT FK_64FA22D6137F3880 FOREIGN KEY (venueSector_id) REFERENCES venue_sector (id)');
26
        $this->addSql('CREATE INDEX IDX_64FA22D65F1583FA ON price_category (performanceEvent_id)');
27
        $this->addSql('CREATE INDEX IDX_64FA22D6137F3880 ON price_category (venueSector_id)');
28
        $this->addSql('ALTER TABLE seat DROP FOREIGN KEY FK_3D5C36664319ED49');
29
        $this->addSql('DROP INDEX IDX_3D5C36664319ED49 ON seat');
30
        $this->addSql('ALTER TABLE seat DROP priceCategory_id');
31
        $this->addSql('ALTER TABLE customer_order CHANGE status status enum(\'free\', \'booked\', \'ordered\', \'opened\', \'closed\')');
32
        $this->addSql('ALTER TABLE ticket CHANGE status status enum(\'free\', \'booked\', \'paid\', \'offline\')');
33
    }
34
35
    /**
36
     * @param Schema $schema
37
     */
38 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...
39
    {
40
        // this down() migration is auto-generated, please modify it to your needs
41
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
42
43
        $this->addSql('ALTER TABLE customer_order CHANGE status status VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci');
44
        $this->addSql('ALTER TABLE price_category DROP FOREIGN KEY FK_64FA22D65F1583FA');
45
        $this->addSql('ALTER TABLE price_category DROP FOREIGN KEY FK_64FA22D6137F3880');
46
        $this->addSql('DROP INDEX IDX_64FA22D65F1583FA ON price_category');
47
        $this->addSql('DROP INDEX IDX_64FA22D6137F3880 ON price_category');
48
        $this->addSql('ALTER TABLE price_category ADD venue_id INT DEFAULT NULL, ADD title VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, DROP rows, DROP places, DROP price, DROP performanceEvent_id, DROP venueSector_id, CHANGE color color VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci');
49
        $this->addSql('ALTER TABLE price_category ADD CONSTRAINT FK_64FA22D640A73EBA FOREIGN KEY (venue_id) REFERENCES venue (id)');
50
        $this->addSql('CREATE INDEX IDX_64FA22D640A73EBA ON price_category (venue_id)');
51
        $this->addSql('ALTER TABLE seat ADD priceCategory_id INT DEFAULT NULL');
52
        $this->addSql('ALTER TABLE seat ADD CONSTRAINT FK_3D5C36664319ED49 FOREIGN KEY (priceCategory_id) REFERENCES price_category (id)');
53
        $this->addSql('CREATE INDEX IDX_3D5C36664319ED49 ON seat (priceCategory_id)');
54
        $this->addSql('ALTER TABLE ticket CHANGE status status VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci');
55
    }
56
}
57