Failed Conditions
Push — master ( 481507...cfb9d3 )
by
unknown
12:41
created

Version20190109165812   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
9
class Version20190109165812 extends AbstractMigration
10
{
11
    public function up(Schema $schema): void
12
    {
13
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
14
15
        $this->addSql('ALTER TABLE transaction ADD bookable_id INT DEFAULT NULL');
16
        $this->addSql('ALTER TABLE transaction ADD CONSTRAINT FK_723705D1EC4F5B2F FOREIGN KEY (bookable_id) REFERENCES bookable (id) ON DELETE SET NULL');
17
        $this->addSql('CREATE INDEX IDX_723705D1EC4F5B2F ON transaction (bookable_id)');
18
        $this->addSql('ALTER TABLE user CHANGE name first_name VARCHAR(191) NOT NULL, ADD last_name VARCHAR(191) NOT NULL AFTER first_name');
19
    }
20
}
21