Completed
Branch master (ec70a9)
by Tobias
25:06 queued 07:11
created

m000508_053522_fix_migration_table::safeUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Class m000508_053522_fix_migration_table
7
 */
8
class m000508_053522_fix_migration_table extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $table = $this->db->schema->getTableSchema('{{%migration}}');
16
        if (isset($table->columns['alias'])) {
17
            // Column exists
18
            $this->alterColumn('{{%migration}}', 'alias', 'varchar(180) DEFAULT NULL');
19
        }
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function safeDown()
26
    {
27
        echo "m000508_053522_fix_migration_table cannot be reverted.\n";
28
29
        return false;
30
    }
31
32
    /*
33
    // Use up()/down() to run migration code without a transaction.
34
    public function up()
35
    {
36
37
    }
38
39
    public function down()
40
    {
41
        echo "m000508_053522_fix_migration_table cannot be reverted.\n";
42
43
        return false;
44
    }
45
    */
46
}
47