Completed
Push — master ( 47fb92...85e008 )
by Adrien
09:22
created

Version20190511044907::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
9
class Version20190511044907 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 bookable CHANGE code code VARCHAR(10) DEFAULT NULL');
16
        $this->addSql('UPDATE bookable SET code = NULL WHERE code = ""');
17
        $this->addSql('CREATE UNIQUE INDEX UNIQ_A10B812477153098 ON bookable (code)');
18
    }
19
}
20