Version20180801183328::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
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 Version20180801183328 extends AbstractMigration
15
{
16
    private const NEW_SIZE = 255;
17
    private const OLD_SIZE = 10;
18
19
    /**
20
     * @throws SchemaException
21
     */
22
    public function up(Schema $schema): void
23
    {
24
        $this->setSize($schema, self::NEW_SIZE);
25
    }
26
27
    /**
28
     * @throws SchemaException
29
     */
30
    public function down(Schema $schema): void
31
    {
32
        $this->setSize($schema, self::OLD_SIZE);
33
    }
34
35
    /**
36
     * @throws SchemaException
37
     */
38
    private function setSize(Schema $schema, int $size): void
39
    {
40
        $schema->getTable('short_urls')->getColumn('short_code')->setLength($size);
41
    }
42
}
43