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

JobMigration_100::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 0
c 0
b 0
f 0
dl 0
loc 2
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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 JobMigration_100
10
 */
11
class JobMigration_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 "JobMigration_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('job', [
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
                        'type',
53
                        [
54
                            'type' => Column::TYPE_CHAR,
55
                            'notNull' => true,
56
                            'size' => 20,
57
                            'after' => 'slug'
58
                        ]
59
                    ),
60
                    new Column(
61
                        'second',
62
                        [
63
                            'type' => Column::TYPE_INTEGER,
64
                            'unsigned' => true,
65
                            'notNull' => false,
66
                            'size' => 2,
67
                            'after' => 'type'
68
                        ]
69
                    ),
70
                    new Column(
71
                        'minute',
72
                        [
73
                            'type' => Column::TYPE_INTEGER,
74
                            'unsigned' => true,
75
                            'notNull' => false,
76
                            'size' => 2,
77
                            'after' => 'second'
78
                        ]
79
                    ),
80
                    new Column(
81
                        'hour',
82
                        [
83
                            'type' => Column::TYPE_INTEGER,
84
                            'unsigned' => true,
85
                            'notNull' => false,
86
                            'size' => 2,
87
                            'after' => 'minute'
88
                        ]
89
                    ),
90
                    new Column(
91
                        'day',
92
                        [
93
                            'type' => Column::TYPE_INTEGER,
94
                            'unsigned' => true,
95
                            'notNull' => false,
96
                            'size' => 2,
97
                            'after' => 'hour'
98
                        ]
99
                    ),
100
                    new Column(
101
                        'month',
102
                        [
103
                            'type' => Column::TYPE_INTEGER,
104
                            'unsigned' => true,
105
                            'notNull' => false,
106
                            'size' => 2,
107
                            'after' => 'day'
108
                        ]
109
                    ),
110
                    new Column(
111
                        'year',
112
                        [
113
                            'type' => Column::TYPE_INTEGER,
114
                            'unsigned' => true,
115
                            'notNull' => false,
116
                            'size' => 4,
117
                            'after' => 'month'
118
                        ]
119
                    ),
120
                    new Column(
121
                        'javascript',
122
                        [
123
                            'type' => Column::TYPE_LONGTEXT,
124
                            'notNull' => false,
125
                            'after' => 'year'
126
                        ]
127
                    ),
128
                    new Column(
129
                        'meta',
130
                        [
131
                            'type' => Column::TYPE_LONGTEXT,
132
                            'notNull' => false,
133
                            'after' => 'javascript'
134
                        ]
135
                    ),
136
                    new Column(
137
                        'last_run_result',
138
                        [
139
                            'type' => Column::TYPE_LONGTEXT,
140
                            'notNull' => false,
141
                            'after' => 'meta'
142
                        ]
143
                    ),
144
                    new Column(
145
                        'last_run_status',
146
                        [
147
                            'type' => Column::TYPE_TINYINTEGER,
148
                            'default' => "0",
149
                            'unsigned' => true,
150
                            'notNull' => true,
151
                            'size' => 1,
152
                            'after' => 'last_run_result'
153
                        ]
154
                    ),
155
                    new Column(
156
                        'run_count',
157
                        [
158
                            'type' => Column::TYPE_BIGINTEGER,
159
                            'default' => "0",
160
                            'unsigned' => true,
161
                            'notNull' => true,
162
                            'size' => 20,
163
                            'after' => 'last_run_status'
164
                        ]
165
                    ),
166
                    new Column(
167
                        'success_count',
168
                        [
169
                            'type' => Column::TYPE_BIGINTEGER,
170
                            'default' => "0",
171
                            'unsigned' => true,
172
                            'notNull' => true,
173
                            'size' => 20,
174
                            'after' => 'run_count'
175
                        ]
176
                    ),
177
                    new Column(
178
                        'error_count',
179
                        [
180
                            'type' => Column::TYPE_BIGINTEGER,
181
                            'default' => "0",
182
                            'unsigned' => true,
183
                            'notNull' => true,
184
                            'size' => 20,
185
                            'after' => 'success_count'
186
                        ]
187
                    ),
188
                    new Column(
189
                        'scheduled_at',
190
                        [
191
                            'type' => Column::TYPE_DATETIME,
192
                            'notNull' => false,
193
                            'after' => 'error_count'
194
                        ]
195
                    ),
196
                    new Column(
197
                        'ran_at',
198
                        [
199
                            'type' => Column::TYPE_DATETIME,
200
                            'notNull' => false,
201
                            'after' => 'scheduled_at'
202
                        ]
203
                    ),
204
                    new Column(
205
                        'created_at',
206
                        [
207
                            'type' => Column::TYPE_DATETIME,
208
                            'default' => "current_timestamp()",
209
                            'notNull' => true,
210
                            'after' => 'ran_at'
211
                        ]
212
                    ),
213
                    new Column(
214
                        'updated_at',
215
                        [
216
                            'type' => Column::TYPE_DATETIME,
217
                            'notNull' => false,
218
                            'after' => 'created_at'
219
                        ]
220
                    ),
221
                    new Column(
222
                        'deleted_at',
223
                        [
224
                            'type' => Column::TYPE_DATETIME,
225
                            'notNull' => false,
226
                            'after' => 'updated_at'
227
                        ]
228
                    ),
229
                    new Column(
230
                        'deprecated_at',
231
                        [
232
                            'type' => Column::TYPE_DATETIME,
233
                            'notNull' => false,
234
                            'after' => 'deleted_at'
235
                        ]
236
                    ),
237
                    new Column(
238
                        'deleted',
239
                        [
240
                            'type' => Column::TYPE_TINYINTEGER,
241
                            'default' => "0",
242
                            'unsigned' => true,
243
                            'notNull' => true,
244
                            'size' => 1,
245
                            'after' => 'deprecated_at'
246
                        ]
247
                    ),
248
                    new Column(
249
                        'deprecated',
250
                        [
251
                            'type' => Column::TYPE_TINYINTEGER,
252
                            'default' => "0",
253
                            'unsigned' => true,
254
                            'notNull' => true,
255
                            'size' => 1,
256
                            'after' => 'deleted'
257
                        ]
258
                    )
259
                ],
260
                'indexes' => [
261
                    new Index('PRIMARY', ['id'], 'PRIMARY'),
262
                    new Index('id_UNIQUE', ['id'], 'UNIQUE'),
263
                    new Index('slug_UNIQUE', ['slug'], 'UNIQUE')
264
                ],
265
                'options' => [
266
                    'table_type' => 'BASE TABLE',
267
                    'auto_increment' => '',
268
                    'engine' => 'InnoDB',
269
                    'table_collation' => 'utf8mb4_general_ci'
270
                ],
271
            ]
272
        );
273
    }
274
275
    /**
276
     * Run the migrations
277
     *
278
     * @return void
279
     */
280
    public function up()
281
    {
282
283
    }
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...
284
285
    /**
286
     * Reverse the migrations
287
     *
288
     * @return void
289
     */
290
    public function down()
291
    {
292
293
    }
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...
294
295
}
296