Completed
Pull Request — master (#191)
by Serhii
02:32
created

Version20210108170343::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineMigrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10 View Code Duplication
final class Version20210108170343 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...
11
{
12
    public function getDescription() : string
13
    {
14
        return 'Added audience field to performance';
15
    }
16
17
    public function up(Schema $schema) : void
18
    {
19
        $this->addSql('
20
            ALTER TABLE performances 
21
            ADD audience ENUM(\'adults\', \'kids\') DEFAULT \'adults\' NOT NULL COMMENT \'(DC2Type:AudienceEnum)\'
22
        ');
23
24
        $this->addSql('
25
            UPDATE performances 
26
            SET `audience` = \'kids\'
27
            WHERE `slug` IN (
28
                \'popieliushka\',
29
                \'zolotie-kurcha\',
30
                \'dorogha-do-sontsia\',
31
                \'aladdin\',
32
                \'korol-drozdoborod\',
33
                \'kit-u-chobotiakh-1\',
34
                \'troie-porosiat-1\',
35
                \'vsi-mishi-liubliat-sir\',
36
                \'vizok-chudies\',
37
                \'siroyizhka\',
38
                \'koza-dierieza\',
39
                \'korolieva-zagublienikh-g-udzikiv\',
40
                \'kotik-pivnik-i-lisichka\',
41
                \'snigova-korolieva\',
42
                \'rizdvianie-viertiepnie-diistvo\',
43
                \'prigodi-v-krayini-svitloforiyi\',
44
                \'barvinok-ghieroi\'
45
            )
46
        ');
47
    }
48
49
    public function down(Schema $schema) : void
50
    {
51
        $this->addSql('ALTER TABLE performances DROP audience');
52
    }
53
}
54