Passed
Push — master ( 1d5530...fba2a1 )
by Nico
56:37 queued 25:57
created

Version20240715115633_ID_CLEANUP   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 30
c 1
b 0
f 0
dl 0
loc 41
ccs 0
cts 32
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 16 1
A down() 0 16 1
A getDescription() 0 3 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
final class Version20240715115633_ID_CLEANUP extends AbstractMigration
11
{
12
    public function getDescription(): string
13
    {
14
        return 'Removes the obsolete map_id and system_map_id columns.';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        $this->addSql('DROP INDEX location_system_map_idx');
20
        $this->addSql('DROP INDEX location_map_idx');
21
        $this->addSql('ALTER TABLE stu_location DROP map_id');
22
        $this->addSql('ALTER TABLE stu_location DROP starsystem_map_id');
23
        $this->addSql('ALTER TABLE stu_anomaly DROP map_id');
24
        $this->addSql('ALTER TABLE stu_anomaly DROP starsystem_map_id');
25
        $this->addSql('ALTER TABLE stu_buoy DROP map_id');
26
        $this->addSql('ALTER TABLE stu_buoy DROP sys_map_id');
27
        $this->addSql('ALTER TABLE stu_flight_sig DROP map_id');
28
        $this->addSql('ALTER TABLE stu_flight_sig DROP starsystem_map_id');
29
        $this->addSql('ALTER TABLE stu_ships DROP map_id');
30
        $this->addSql('ALTER TABLE stu_ships DROP starsystem_map_id');
31
        $this->addSql('ALTER TABLE stu_tachyon_scan DROP map_id');
32
        $this->addSql('ALTER TABLE stu_tachyon_scan DROP starsystem_map_id');
33
    }
34
35
    public function down(Schema $schema): void
36
    {
37
        $this->addSql('ALTER TABLE stu_tachyon_scan ADD map_id INT DEFAULT NULL');
38
        $this->addSql('ALTER TABLE stu_tachyon_scan ADD starsystem_map_id INT DEFAULT NULL');
39
        $this->addSql('ALTER TABLE stu_ships ADD map_id INT DEFAULT NULL');
40
        $this->addSql('ALTER TABLE stu_ships ADD starsystem_map_id INT DEFAULT NULL');
41
        $this->addSql('ALTER TABLE stu_flight_sig ADD map_id INT DEFAULT NULL');
42
        $this->addSql('ALTER TABLE stu_flight_sig ADD starsystem_map_id INT DEFAULT NULL');
43
        $this->addSql('ALTER TABLE stu_buoy ADD map_id INT DEFAULT NULL');
44
        $this->addSql('ALTER TABLE stu_buoy ADD sys_map_id INT DEFAULT NULL');
45
        $this->addSql('ALTER TABLE stu_anomaly ADD map_id INT DEFAULT NULL');
46
        $this->addSql('ALTER TABLE stu_anomaly ADD starsystem_map_id INT DEFAULT NULL');
47
        $this->addSql('ALTER TABLE stu_location ADD map_id INT DEFAULT NULL');
48
        $this->addSql('ALTER TABLE stu_location ADD starsystem_map_id INT DEFAULT NULL');
49
        $this->addSql('CREATE INDEX location_system_map_idx ON stu_location (starsystem_map_id)');
50
        $this->addSql('CREATE INDEX location_map_idx ON stu_location (map_id)');
51
    }
52
}
53