Version20200131091633::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 19
ccs 0
cts 5
cp 0
crap 2
rs 9.6333
c 0
b 0
f 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
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13
final class Version20200131091633 extends AbstractMigration
14
{
15
    public function getDescription() : string
16
    {
17
        return 'Fixed DeleteAt for Roles which is part of deleted performances';
18
    }
19
20
    public function up(Schema $schema) : void
21
    {
22
        // this up() migration is auto-generated, please modify it to your needs
23
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
24
25
        $this->addSql(
26
<<<SQL
27
UPDATE roles
28
INNER JOIN performances ON performances.id = roles.performance_id
29
SET 
30
    roles.deletedAt = performances.deletedAt,
31
    roles.deletedBy = 'migration20200131091633'
32
WHERE
33
    performances.deletedAt IS NOT NULL
34
    AND roles.deletedAt IS NUll
35
;
36
SQL
37
        );
38
    }
39
40
    public function down(Schema $schema) : void
41
    {}
42
}
43