m200830_030728_create_sort_column   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 5 1
A safeDown() 0 8 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Class m200830_030728_create_sort_column
7
 */
8
class m200830_030728_create_sort_column extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->addColumn('{{rule}}', 'sort', $this->tinyInteger()->defaultValue(99)->after('status'));
16
        $this->addColumn('{{account}}', 'sort', $this->tinyInteger()->defaultValue(99)->after('default'));
17
        $this->addColumn('{{category}}', 'sort', $this->tinyInteger()->defaultValue(99)->after('default'));
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function safeDown()
24
    {
25
        echo "m200830_030728_create_sort_column cannot be reverted.\n";
26
        $this->dropColumn('{{rule}}', 'sort');
27
        $this->dropColumn('{{account}}', 'sort');
28
        $this->dropColumn('{{category}}', 'sort');
29
30
        return true;
31
    }
32
33
    /*
34
    // Use up()/down() to run migration code without a transaction.
35
    public function up()
36
    {
37
38
    }
39
40
    public function down()
41
    {
42
        echo "m200830_030728_create_sort_column cannot be reverted.\n";
43
44
        return false;
45
    }
46
    */
47
}
48