Completed
Push — master ( 065cdd...96faaf )
by Alejandro
09:28
created

Version20160819142757::up()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 8
c 1
b 0
f 1
nc 3
nop 1
dl 0
loc 12
rs 9.4285
1
<?php
2
3
namespace ShlinkMigrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
8
/**
9
 * Auto-generated Migration: Please modify to your needs!
10
 */
11
class Version20160819142757 extends AbstractMigration
12
{
13
    const MYSQL = 'mysql';
14
    const SQLITE = 'sqlite';
15
16
    /**
17
     * @param Schema $schema
18
     */
19
    public function up(Schema $schema)
20
    {
21
        $db = $this->connection->getDatabasePlatform()->getName();
22
        $table = $schema->getTable('short_urls');
23
        $column = $table->getColumn('short_code');
24
25
        if ($db === self::MYSQL) {
26
            $column->setPlatformOption('collation', 'utf8_bin');
27
        } elseif ($db === self::SQLITE) {
28
            $column->setPlatformOption('collate', 'BINARY');
29
        }
30
    }
31
32
    /**
33
     * @param Schema $schema
34
     */
35
    public function down(Schema $schema)
36
    {
37
        $db = $this->connection->getDatabasePlatform()->getName();
0 ignored issues
show
Unused Code introduced by
$db is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
38
    }
39
}
40