Passed
Branch master (89bdb5)
by Janko
11:58
created

Version20250514115823_Reset_fixes   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 10
dl 0
loc 23
rs 10
c 1
b 1
f 0
wmc 3
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 Version20250514115823_Reset_fixes extends AbstractMigration
11
{
12
    public function getDescription(): string
13
    {
14
        return 'Some Schema modifications to fix issues with the reset command';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        $this->addSql('ALTER TABLE stu_alliance_settings DROP CONSTRAINT FK_39FF05F710A0EA3F');
20
        $this->addSql('ALTER TABLE stu_alliance_settings ADD CONSTRAINT FK_39FF05F710A0EA3F FOREIGN KEY (alliance_id) REFERENCES stu_alliances (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
21
22
        $this->addSql('ALTER TABLE stu_wormhole_restrictions DROP CONSTRAINT FK_76C7B8E0A76ED395');
23
        $this->addSql('ALTER TABLE stu_wormhole_restrictions ADD CONSTRAINT FK_76C7B8E0A76ED395 FOREIGN KEY (user_id) REFERENCES stu_user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
24
    }
25
26
    public function down(Schema $schema): void
27
    {
28
        $this->addSql('ALTER TABLE stu_alliance_settings DROP CONSTRAINT fk_39ff05f710a0ea3f');
29
        $this->addSql('ALTER TABLE stu_alliance_settings ADD CONSTRAINT fk_39ff05f710a0ea3f FOREIGN KEY (alliance_id) REFERENCES stu_alliances (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
30
31
        $this->addSql('ALTER TABLE stu_wormhole_restrictions DROP CONSTRAINT fk_76c7b8e0a76ed395');
32
        $this->addSql('ALTER TABLE stu_wormhole_restrictions ADD CONSTRAINT fk_76c7b8e0a76ed395 FOREIGN KEY (user_id) REFERENCES stu_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
33
    }
34
}
35