m221130_224500_add_priorities_column   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
dl 0
loc 24
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 8 2
A safeDown() 0 4 1
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\db\Migration;
6
7
/**
8
 * m221130_224500_add_priorities_column migration.
0 ignored issues
show
Coding Style introduced by
Doc comment short description must start with a capital letter
Loading history...
9
 */
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...
10
class m221130_224500_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 M221130_224500_Add_Priorities_Column instead
Loading history...
11
{
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @inheritdoc
14
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
15
    public function safeUp()
16
    {
17
        // Add in the siteId columns
18
        if (!$this->db->columnExists('{{%retour_static_redirects}}', 'priority')) {
19
            $this->addColumn(
20
                '{{%retour_static_redirects}}',
21
                'priority',
22
                $this->integer()->null()->after('redirectHttpCode')->defaultValue(5)
23
            );
24
        }
25
    }
26
27
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
28
     * @inheritdoc
29
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
30
    public function safeDown()
31
    {
32
        echo "m221130_224500_add_priorities_column cannot be reverted.\n";
33
        return false;
34
    }
35
}
36