Passed
Pull Request — master (#2138)
by Nico
25:02 queued 13:24
created

Version20250610150652::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Migrations\Pgsql;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
final class Version20250610150652 extends AbstractMigration
11
{
12
    public function getDescription(): string
13
    {
14
        return 'Reset the primary key of crew assignments.';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        $this->addSql(<<<'SQL'
20
            DROP INDEX crew_assign_crew_idx
21
        SQL);
22
        $this->addSql(<<<'SQL'
23
            ALTER TABLE stu_crew_assign DROP id
24
        SQL);
25
        $this->addSql(<<<'SQL'
26
            ALTER TABLE stu_crew_assign ADD PRIMARY KEY (crew_id)
27
        SQL);
28
    }
29
30
    public function down(Schema $schema): void
31
    {
32
        $this->addSql(<<<'SQL'
33
            DROP INDEX idx_223179_primary
34
        SQL);
35
        $this->addSql(<<<'SQL'
36
            ALTER TABLE stu_crew_assign ADD id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL
37
        SQL);
38
        $this->addSql(<<<'SQL'
39
            CREATE UNIQUE INDEX crew_assign_crew_idx ON stu_crew_assign (crew_id)
40
        SQL);
41
        $this->addSql(<<<'SQL'
42
            ALTER TABLE stu_crew_assign ADD PRIMARY KEY (id)
43
        SQL);
44
    }
45
}
46