m170314_062153_create_table_confirmation_request   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 2
cbo 2
dl 0
loc 89
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 51 1
B safeDown() 0 28 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation for table `{{%confirmation_request}}`.
7
 */
8
class m170314_062153_create_table_confirmation_request extends Migration
2 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function safeUp()
14
    {
15
        $this->createTable('{{%confirmation_request}}', [
16
17
            'id' => $this->primaryKey()->unsigned()->notNull(),
18
            'model' => $this->string(255),
19
            'object_id' => $this->integer(11)->unsigned(),
20
            'object' => $this->text(),
21
            'release_token' => $this->string(255),
22
            'created_at' => $this->integer(11),
23
            'updated_at' => $this->integer(11),
24
            'values' => $this->text(),
25
            'created_by' => $this->integer(11)->unsigned(),
26
            'updated_by' => $this->integer(11)->unsigned(),
27
28
        ]);
29
 
30
        // creates index for column `created_by`
31
        $this->createIndex(
32
            'confirmation_request_ibfk_2',
33
            '{{%confirmation_request}}',
34
            'created_by'
35
        );
36
37
        // add foreign key for table `user`
38
        $this->addForeignKey(
39
            'confirmation_request_ibfk_2',
40
            '{{%confirmation_request}}',
41
            'created_by',
42
            '{{%user}}',
43
            'id',
44
            'CASCADE'
45
        );
46
47
        // creates index for column `updated_by`
48
        $this->createIndex(
49
            'confirmation_request_ibfk_3',
50
            '{{%confirmation_request}}',
51
            'updated_by'
52
        );
53
54
        // add foreign key for table `user`
55
        $this->addForeignKey(
56
            'confirmation_request_ibfk_3',
57
            '{{%confirmation_request}}',
58
            'updated_by',
59
            '{{%user}}',
60
            'id',
61
            'CASCADE'
62
        );
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68
    public function safeDown()
69
    {
70
        // drops foreign key for table `user`
71
        $this->dropForeignKey(
72
            'confirmation_request_ibfk_2',
73
            '{{%confirmation_request}}'
74
        );
75
76
        // drops index for column `created_by`
77
        $this->dropIndex(
78
            'confirmation_request_ibfk_2',
79
            '{{%confirmation_request}}'
80
        );
81
82
        // drops foreign key for table `user`
83
        $this->dropForeignKey(
84
            'confirmation_request_ibfk_3',
85
            '{{%confirmation_request}}'
86
        );
87
88
        // drops index for column `updated_by`
89
        $this->dropIndex(
90
            'confirmation_request_ibfk_3',
91
            '{{%confirmation_request}}'
92
        );
93
94
        $this->dropTable('{{%confirmation_request}}');
95
    }
96
}
97