Test Failed
Push — master ( 741545...e25e21 )
by Julien
11:23
created

RoleRoleMigration_100   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 154
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 88
c 0
b 0
f 0
dl 0
loc 154
ccs 0
cts 33
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 2 1
B morph() 0 125 1
A up() 0 2 1
1
<?php 
2
3
use Phalcon\Db\Column;
4
use Phalcon\Db\Index;
5
use Phalcon\Db\Reference;
6
use Phalcon\Migrations\Mvc\Model\Migration;
7
8
/**
9
 * Class RoleRoleMigration_100
10
 */
11
class RoleRoleMigration_100 extends Migration
0 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
Class name "RoleRoleMigration_100" is not in PascalCase 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...
12
{
13
    /**
14
     * Define the table structure
15
     *
16
     * @return void
17
     */
18
    public function morph()
19
    {
20
        $this->morphTable('role_role', [
21
                'columns' => [
22
                    new Column(
23
                        'id',
24
                        [
25
                            'type' => Column::TYPE_INTEGER,
26
                            'unsigned' => true,
27
                            'notNull' => true,
28
                            'autoIncrement' => true,
29
                            'size' => 10,
30
                            'first' => true
31
                        ]
32
                    ),
33
                    new Column(
34
                        'role_id',
35
                        [
36
                            'type' => Column::TYPE_INTEGER,
37
                            'unsigned' => true,
38
                            'notNull' => true,
39
                            'size' => 10,
40
                            'after' => 'id'
41
                        ]
42
                    ),
43
                    new Column(
44
                        'extend_role_id',
45
                        [
46
                            'type' => Column::TYPE_INTEGER,
47
                            'unsigned' => true,
48
                            'notNull' => true,
49
                            'size' => 10,
50
                            'after' => 'role_id'
51
                        ]
52
                    ),
53
                    new Column(
54
                        'created_at',
55
                        [
56
                            'type' => Column::TYPE_DATETIME,
57
                            'notNull' => true,
58
                            'after' => 'extend_role_id'
59
                        ]
60
                    ),
61
                    new Column(
62
                        'updated_at',
63
                        [
64
                            'type' => Column::TYPE_DATETIME,
65
                            'notNull' => false,
66
                            'after' => 'created_at'
67
                        ]
68
                    ),
69
                    new Column(
70
                        'deleted_at',
71
                        [
72
                            'type' => Column::TYPE_DATETIME,
73
                            'notNull' => false,
74
                            'after' => 'updated_at'
75
                        ]
76
                    ),
77
                    new Column(
78
                        'deprecated_at',
79
                        [
80
                            'type' => Column::TYPE_DATETIME,
81
                            'notNull' => false,
82
                            'after' => 'deleted_at'
83
                        ]
84
                    ),
85
                    new Column(
86
                        'deprecated',
87
                        [
88
                            'type' => Column::TYPE_TINYINTEGER,
89
                            'default' => "0",
90
                            'unsigned' => true,
91
                            'notNull' => true,
92
                            'size' => 1,
93
                            'after' => 'deprecated_at'
94
                        ]
95
                    ),
96
                    new Column(
97
                        'deleted',
98
                        [
99
                            'type' => Column::TYPE_TINYINTEGER,
100
                            'default' => "0",
101
                            'unsigned' => true,
102
                            'notNull' => true,
103
                            'size' => 1,
104
                            'after' => 'deprecated'
105
                        ]
106
                    )
107
                ],
108
                'indexes' => [
109
                    new Index('PRIMARY', ['id'], 'PRIMARY'),
110
                    new Index('id_UNIQUE', ['id'], 'UNIQUE'),
111
                    new Index('role_role_role_id_fk_idx', ['role_id'], ''),
112
                    new Index('role_role_extend_role_id_fk_idx', ['extend_role_id'], '')
113
                ],
114
                'references' => [
115
                    new Reference(
116
                        'role_role_extend_role_id_fk',
117
                        [
118
                            'referencedTable' => 'role',
119
                            'referencedSchema' => 'zemit',
120
                            'columns' => ['extend_role_id'],
121
                            'referencedColumns' => ['id'],
122
                            'onUpdate' => 'CASCADE',
123
                            'onDelete' => 'CASCADE'
124
                        ]
125
                    ),
126
                    new Reference(
127
                        'role_role_role_id_fk',
128
                        [
129
                            'referencedTable' => 'role',
130
                            'referencedSchema' => 'zemit',
131
                            'columns' => ['role_id'],
132
                            'referencedColumns' => ['id'],
133
                            'onUpdate' => 'CASCADE',
134
                            'onDelete' => 'CASCADE'
135
                        ]
136
                    )
137
                ],
138
                'options' => [
139
                    'table_type' => 'BASE TABLE',
140
                    'auto_increment' => '',
141
                    'engine' => 'InnoDB',
142
                    'table_collation' => 'utf8mb4_general_ci'
143
                ],
144
            ]
145
        );
146
    }
147
148
    /**
149
     * Run the migrations
150
     *
151
     * @return void
152
     */
153
    public function up()
154
    {
155
156
    }
0 ignored issues
show
Coding Style introduced by
Function closing brace must go on the next line following the body; found 1 blank lines before brace
Loading history...
157
158
    /**
159
     * Reverse the migrations
160
     *
161
     * @return void
162
     */
163
    public function down()
164
    {
165
166
    }
0 ignored issues
show
Coding Style introduced by
Function closing brace must go on the next line following the body; found 1 blank lines before brace
Loading history...
167
168
}
169