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

TriggerMigration_100   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 143
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 78
c 0
b 0
f 0
dl 0
loc 143
ccs 0
cts 28
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 2 1
A up() 0 2 1
B morph() 0 114 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 TriggerMigration_100
10
 */
11
class TriggerMigration_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 "TriggerMigration_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('trigger', [
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
                        'name',
35
                        [
36
                            'type' => Column::TYPE_VARCHAR,
37
                            'notNull' => true,
38
                            'size' => 120,
39
                            'after' => 'id'
40
                        ]
41
                    ),
42
                    new Column(
43
                        'slug',
44
                        [
45
                            'type' => Column::TYPE_VARCHAR,
46
                            'notNull' => true,
47
                            'size' => 120,
48
                            'after' => 'name'
49
                        ]
50
                    ),
51
                    new Column(
52
                        'javascript',
53
                        [
54
                            'type' => Column::TYPE_LONGTEXT,
55
                            'notNull' => false,
56
                            'after' => 'slug'
57
                        ]
58
                    ),
59
                    new Column(
60
                        'meta',
61
                        [
62
                            'type' => Column::TYPE_LONGTEXT,
63
                            'notNull' => false,
64
                            'after' => 'javascript'
65
                        ]
66
                    ),
67
                    new Column(
68
                        'created_at',
69
                        [
70
                            'type' => Column::TYPE_DATETIME,
71
                            'notNull' => false,
72
                            'after' => 'meta'
73
                        ]
74
                    ),
75
                    new Column(
76
                        'updated_at',
77
                        [
78
                            'type' => Column::TYPE_DATETIME,
79
                            'notNull' => false,
80
                            'after' => 'created_at'
81
                        ]
82
                    ),
83
                    new Column(
84
                        'deleted_at',
85
                        [
86
                            'type' => Column::TYPE_DATETIME,
87
                            'notNull' => false,
88
                            'after' => 'updated_at'
89
                        ]
90
                    ),
91
                    new Column(
92
                        'deprecated_at',
93
                        [
94
                            'type' => Column::TYPE_DATETIME,
95
                            'notNull' => false,
96
                            'after' => 'deleted_at'
97
                        ]
98
                    ),
99
                    new Column(
100
                        'deleted',
101
                        [
102
                            'type' => Column::TYPE_TINYINTEGER,
103
                            'default' => "0",
104
                            'unsigned' => true,
105
                            'notNull' => true,
106
                            'size' => 1,
107
                            'after' => 'deprecated_at'
108
                        ]
109
                    ),
110
                    new Column(
111
                        'deprecated',
112
                        [
113
                            'type' => Column::TYPE_TINYINTEGER,
114
                            'default' => "0",
115
                            'unsigned' => true,
116
                            'notNull' => true,
117
                            'size' => 1,
118
                            'after' => 'deleted'
119
                        ]
120
                    )
121
                ],
122
                'indexes' => [
123
                    new Index('PRIMARY', ['id'], 'PRIMARY'),
124
                    new Index('id_UNIQUE', ['id'], 'UNIQUE'),
125
                    new Index('slug_UNIQUE', ['slug'], 'UNIQUE')
126
                ],
127
                'options' => [
128
                    'table_type' => 'BASE TABLE',
129
                    'auto_increment' => '',
130
                    'engine' => 'InnoDB',
131
                    'table_collation' => 'utf8mb4_general_ci'
132
                ],
133
            ]
134
        );
135
    }
136
137
    /**
138
     * Run the migrations
139
     *
140
     * @return void
141
     */
142
    public function up()
143
    {
144
145
    }
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...
146
147
    /**
148
     * Reverse the migrations
149
     *
150
     * @return void
151
     */
152
    public function down()
153
    {
154
155
    }
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...
156
157
}
158