m181018_123901_add_stats_info   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 24
dl 0
loc 47
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 5 1
A safeUp() 0 32 5
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
 * m181018_123901_add_stats_info 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 m181018_123901_add_stats_info 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 M181018_123901_Add_Stats_Info 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(): bool
16
    {
17
        if (!$this->db->columnExists('{{%retour_stats}}', 'exceptionFileLine')) {
18
            $this->addColumn(
19
                '{{%retour_stats}}',
20
                'exceptionFileLine',
21
                $this->integer(45)->after('remoteIp')->defaultValue(0)
22
            );
23
        }
24
        if (!$this->db->columnExists('{{%retour_stats}}', 'exceptionFilePath')) {
25
            $this->addColumn(
26
                '{{%retour_stats}}',
27
                'exceptionFilePath',
28
                $this->string(255)->after('remoteIp')->defaultValue('')
29
            );
30
        }
31
        if (!$this->db->columnExists('{{%retour_stats}}', 'exceptionMessage')) {
32
            $this->addColumn(
33
                '{{%retour_stats}}',
34
                'exceptionMessage',
35
                $this->string(255)->after('remoteIp')->defaultValue('')
36
            );
37
        }
38
        if (!$this->db->columnExists('{{%retour_stats}}', 'userAgent')) {
39
            $this->addColumn(
40
                '{{%retour_stats}}',
41
                'userAgent',
42
                $this->string(255)->after('remoteIp')->defaultValue('')
43
            );
44
        }
45
46
        return true;
47
    }
48
49
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
50
     * @inheritdoc
51
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
52
    public function safeDown(): bool
53
    {
54
        echo "m181018_123901_add_stats_info cannot be reverted.\n";
55
56
        return false;
57
    }
58
}
59