Passed
Pull Request — master (#1837)
by Nico
24:51
created

Version20240705092745_StarSystem::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
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 Version20240705092745_StarSystem extends AbstractMigration
11
{
12
    public function getDescription(): string
13
    {
14
        return 'Removes the following obsolete fields from stu_systems: cx, cy';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        $this->addSql('DROP INDEX coordinate_idx;');
20
        $this->addSql('ALTER TABLE stu_systems DROP cx;');
21
        $this->addSql('ALTER TABLE stu_systems DROP cy;');
22
    }
23
24
    public function down(Schema $schema): void
25
    {
26
        $this->addSql('ALTER TABLE stu_systems ADD cx SMALLINT DEFAULT NULL;');
27
        $this->addSql('ALTER TABLE stu_systems ADD cy SMALLINT DEFAULT NULL;');
28
        $this->addSql('CREATE INDEX coordinate_idx ON stu_systems (cx, cy);');
29
    }
30
}
31