Failed Conditions
Push — master ( 2695cf...ba7e19 )
by Sylvain
08:48 queued 11s
created

Version20210707145050   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
dl 0
loc 11
ccs 0
cts 5
cp 0
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Ecodev\Felix\Migration\IrreversibleMigration;
9
10
class Version20210707145050 extends IrreversibleMigration
11
{
12
    public function up(Schema $schema): void
13
    {
14
        // Add new booking types to enum
15
        $this->addSql('ALTER TABLE bookable MODIFY booking_type ENUM(\'self_approved\', \'admin_approved\', \'application\', \'admin_assigned\', \'admin_only\', \'mandatory\') DEFAULT \'self_approved\' NOT NULL');
16
        // Migrate values of existing booking types
17
        $this->addSql('UPDATE bookable SET booking_type = \'application\' WHERE booking_type = \'admin_approved\'');
18
        $this->addSql('UPDATE bookable SET booking_type = \'admin_assigned\' WHERE booking_type = \'admin_only\'');
19
        // Remove old booking types from enum
20
        $this->addSql('ALTER TABLE bookable MODIFY booking_type ENUM(\'self_approved\', \'application\', \'admin_assigned\', \'mandatory\') DEFAULT \'self_approved\' NOT NULL COMMENT \'(DC2Type:BookingType)\'');
21
    }
22
}
23