Failed Conditions
Push — master ( 7ddf51...0a0c4a )
by Adrien
06:37
created

Version20190125001731   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
9
class Version20190125001731 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 user CHANGE role role ENUM(\'booking_only\', \'individual\', \'member\', \'responsible\', \'administrator\') DEFAULT \'individual\' NOT NULL COMMENT \'(DC2Type:UserRole)\'');
16
17
        $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649602AD315');
18
        $this->addSql('DROP INDEX IDX_8D93D649602AD315 ON user');
19
        $this->addSql('UPDATE user SET owner_id = responsible_id');
20
        $this->addSql('ALTER TABLE user DROP responsible_id');
21
22
        $this->addSql('ALTER TABLE booking DROP FOREIGN KEY FK_E00CEDDE602AD315');
23
        $this->addSql('DROP INDEX IDX_E00CEDDE602AD315 ON booking');
24
        $this->addSql('UPDATE booking SET owner_id = responsible_id');
25
        $this->addSql('ALTER TABLE booking DROP responsible_id');
26
    }
27
}
28