Completed
Push — master ( 5bb9e4...33b9a4 )
by Serhii
09:16 queued 09:08
created

Version20170411225256::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 1
dl 9
loc 9
rs 9.6666
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 View Code Duplication
class Version20170411225256 extends AbstractMigration
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    /**
14
     * @param Schema $schema
15
     */
16
    public function up(Schema $schema)
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 ticket ADD price_category_id INT NOT NULL');
22
        $this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA3159FD1F4 FOREIGN KEY (price_category_id) REFERENCES price_category (id)');
23
        $this->addSql('CREATE INDEX IDX_97A0ADA3159FD1F4 ON ticket (price_category_id)');
24
    }
25
26
    /**
27
     * @param Schema $schema
28
     */
29
    public function down(Schema $schema)
30
    {
31
        // this down() migration is auto-generated, please modify it to your needs
32
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
33
34
        $this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA3159FD1F4');
35
        $this->addSql('DROP INDEX IDX_97A0ADA3159FD1F4 ON ticket');
36
        $this->addSql('ALTER TABLE ticket DROP price_category_id');
37
    }
38
}
39