Passed
Push — dev ( 5ebfc2...850c22 )
by Janko
12:27
created

Version20240715115633_ID_CLEANUP   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 17 1
A getDescription() 0 4 1
A down() 0 17 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Migrations\Pgsql;
6
7
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Doctrine\DBAL\Schema\Schema;
9
use Doctrine\Migrations\AbstractMigration;
10
11
final class Version20240715115633_ID_CLEANUP extends AbstractMigration
12
{
13
    #[Override]
14
    public function getDescription(): string
15
    {
16
        return 'Removes the obsolete map_id and system_map_id columns.';
17
    }
18
19
    #[Override]
20
    public function up(Schema $schema): void
21
    {
22
        $this->addSql('DROP INDEX location_system_map_idx');
23
        $this->addSql('DROP INDEX location_map_idx');
24
        $this->addSql('ALTER TABLE stu_location DROP map_id');
25
        $this->addSql('ALTER TABLE stu_location DROP starsystem_map_id');
26
        $this->addSql('ALTER TABLE stu_anomaly DROP map_id');
27
        $this->addSql('ALTER TABLE stu_anomaly DROP starsystem_map_id');
28
        $this->addSql('ALTER TABLE stu_buoy DROP map_id');
29
        $this->addSql('ALTER TABLE stu_buoy DROP sys_map_id');
30
        $this->addSql('ALTER TABLE stu_flight_sig DROP map_id');
31
        $this->addSql('ALTER TABLE stu_flight_sig DROP starsystem_map_id');
32
        $this->addSql('ALTER TABLE stu_ships DROP map_id');
33
        $this->addSql('ALTER TABLE stu_ships DROP starsystem_map_id');
34
        $this->addSql('ALTER TABLE stu_tachyon_scan DROP map_id');
35
        $this->addSql('ALTER TABLE stu_tachyon_scan DROP starsystem_map_id');
36
    }
37
38
    #[Override]
39
    public function down(Schema $schema): void
40
    {
41
        $this->addSql('ALTER TABLE stu_tachyon_scan ADD map_id INT DEFAULT NULL');
42
        $this->addSql('ALTER TABLE stu_tachyon_scan ADD starsystem_map_id INT DEFAULT NULL');
43
        $this->addSql('ALTER TABLE stu_ships ADD map_id INT DEFAULT NULL');
44
        $this->addSql('ALTER TABLE stu_ships ADD starsystem_map_id INT DEFAULT NULL');
45
        $this->addSql('ALTER TABLE stu_flight_sig ADD map_id INT DEFAULT NULL');
46
        $this->addSql('ALTER TABLE stu_flight_sig ADD starsystem_map_id INT DEFAULT NULL');
47
        $this->addSql('ALTER TABLE stu_buoy ADD map_id INT DEFAULT NULL');
48
        $this->addSql('ALTER TABLE stu_buoy ADD sys_map_id INT DEFAULT NULL');
49
        $this->addSql('ALTER TABLE stu_anomaly ADD map_id INT DEFAULT NULL');
50
        $this->addSql('ALTER TABLE stu_anomaly ADD starsystem_map_id INT DEFAULT NULL');
51
        $this->addSql('ALTER TABLE stu_location ADD map_id INT DEFAULT NULL');
52
        $this->addSql('ALTER TABLE stu_location ADD starsystem_map_id INT DEFAULT NULL');
53
        $this->addSql('CREATE INDEX location_system_map_idx ON stu_location (starsystem_map_id)');
54
        $this->addSql('CREATE INDEX location_map_idx ON stu_location (map_id)');
55
    }
56
}
57