Version20181020065148::up()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ShlinkMigrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\DBAL\Schema\SchemaException;
9
use Doctrine\Migrations\AbstractMigration;
10
11
/**
12
 * Auto-generated Migration: Please modify to your needs!
13
 */
14
final class Version20181020065148 extends AbstractMigration
15
{
16
    private const CAMEL_CASE_COLUMNS = [
17
        'countryCode',
18
        'countryName',
19
        'regionName',
20
        'cityName',
21
    ];
22
23
    /**
24
     * @throws SchemaException
25
     */
26
    public function up(Schema $schema): void
27
    {
28
        $visitLocations = $schema->getTable('visit_locations');
29
30
        foreach (self::CAMEL_CASE_COLUMNS as $name) {
31
            if ($visitLocations->hasColumn($name)) {
32
                $visitLocations->dropColumn($name);
33
            }
34
        }
35
    }
36
37
    public function down(Schema $schema): void
38
    {
39
        // No down
40
    }
41
}
42