Passed
Push — v3 ( 3b0b82...603cd9 )
by Andrew
14:27 queued 05:38
created

m221129_221000_add_priorities_column::safeUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace nystudio107\retour\migrations;
4
5
use Craft;
6
use craft\db\Migration;
7
8
/**
9
 * m221129_221000_add_priorities_column migration.
0 ignored issues
show
Coding Style introduced by
Doc comment short description must start with a capital letter
Loading history...
10
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
11
class m221129_221000_add_priorities_column extends Migration
0 ignored issues
show
Coding Style introduced by
Class name must begin with a capital letter
Loading history...
Coding Style introduced by
Class name is not valid; consider M221129_221000_Add_Priorities_Column instead
Loading history...
12
{
13
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
14
     * @inheritdoc
15
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
16
    public function safeUp()
17
    {
18
        // Add in the siteId columns
19
        if (!$this->db->columnExists('{{%retour_static_redirects}}', 'priority')) {
20
            $this->addColumn(
21
                '{{%retour_static_redirects}}',
22
                'priority',
23
                $this->integer()->null()->after('redirectHttpCode')->defaultValue(5)
24
            );
25
        }
26
    }
27
28
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
29
     * @inheritdoc
30
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
31
    public function safeDown()
32
    {
33
        echo "m221129_221000_add_priorities_column cannot be reverted.\n";
34
        return false;
35
    }
36
}
37