Passed
Push — master ( 77a570...adeb98 )
by Nico
26:43
created

Version20240930084058_Retrofit   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 28
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A up() 0 9 1
A down() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Migrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
11
final class Version20240930084058_Retrofit extends AbstractMigration
12
{
13
    public function getDescription(): string
14
    {
15
        return 'Retrofit ship queue';
16
    }
17
18
    public function up(Schema $schema): void
19
    {
20
        $this->addSql('ALTER TABLE stu_colonies_shipqueue ADD mode INT DEFAULT NULL');
21
        $this->addSql('ALTER TABLE stu_colonies_shipqueue ADD ship_id INT DEFAULT NULL');
22
        $this->addSql('ALTER TABLE stu_colonies_shipqueue ADD CONSTRAINT FK_BEDCCA2FC256317D FOREIGN KEY (ship_id) REFERENCES stu_ships (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
23
        $this->addSql('CREATE UNIQUE INDEX UNIQ_BEDCCA2FC256317D ON stu_colonies_shipqueue (ship_id)');
24
        $this->addSql('ALTER INDEX idx_ab6e5ae96a392d53 RENAME TO IDX_B00DC07A6A392D53');
25
        $this->addSql('ALTER INDEX idx_ab6e5ae91136be75 RENAME TO IDX_B00DC07A1136BE75');
26
        $this->addSql('ALTER INDEX idx_5f64a41aa76ed395 RENAME TO IDX_6E46626CA76ED395');
27
    }
28
29
    public function down(Schema $schema): void
30
    {
31
        $this->addSql('CREATE SCHEMA public');
32
        $this->addSql('ALTER TABLE stu_colonies_shipqueue DROP CONSTRAINT FK_BEDCCA2FC256317D');
33
        $this->addSql('DROP INDEX UNIQ_BEDCCA2FC256317D');
34
        $this->addSql('ALTER TABLE stu_colonies_shipqueue DROP mode');
35
        $this->addSql('ALTER TABLE stu_colonies_shipqueue DROP ship_id');
36
        $this->addSql('ALTER INDEX idx_b00dc07a6a392d53 RENAME TO idx_ab6e5ae96a392d53');
37
        $this->addSql('ALTER INDEX idx_b00dc07a1136be75 RENAME TO idx_ab6e5ae91136be75');
38
        $this->addSql('ALTER INDEX idx_6e46626ca76ed395 RENAME TO idx_5f64a41aa76ed395');
39
    }
40
}
41