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

BackupMigration_100::up()   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 BackupMigration_100
10
 */
11
class BackupMigration_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 "BackupMigration_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('backup', [
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
                        'user_id',
35
                        [
36
                            'type' => Column::TYPE_INTEGER,
37
                            'unsigned' => true,
38
                            'notNull' => false,
39
                            'size' => 10,
40
                            'after' => 'id'
41
                        ]
42
                    ),
43
                    new Column(
44
                        'name',
45
                        [
46
                            'type' => Column::TYPE_VARCHAR,
47
                            'notNull' => true,
48
                            'size' => 255,
49
                            'after' => 'user_id'
50
                        ]
51
                    ),
52
                    new Column(
53
                        'path',
54
                        [
55
                            'type' => Column::TYPE_VARCHAR,
56
                            'notNull' => false,
57
                            'size' => 255,
58
                            'after' => 'name'
59
                        ]
60
                    ),
61
                    new Column(
62
                        'mimetype',
63
                        [
64
                            'type' => Column::TYPE_CHAR,
65
                            'notNull' => false,
66
                            'size' => 60,
67
                            'after' => 'path'
68
                        ]
69
                    ),
70
                    new Column(
71
                        'type',
72
                        [
73
                            'type' => Column::TYPE_CHAR,
74
                            'notNull' => true,
75
                            'size' => 60,
76
                            'after' => 'mimetype'
77
                        ]
78
                    ),
79
                    new Column(
80
                        'completed',
81
                        [
82
                            'type' => Column::TYPE_INTEGER,
83
                            'default' => "0",
84
                            'unsigned' => true,
85
                            'notNull' => true,
86
                            'size' => 1,
87
                            'after' => 'type'
88
                        ]
89
                    ),
90
                    new Column(
91
                        'downloaded',
92
                        [
93
                            'type' => Column::TYPE_INTEGER,
94
                            'unsigned' => true,
95
                            'notNull' => false,
96
                            'size' => 2,
97
                            'after' => 'completed'
98
                        ]
99
                    ),
100
                    new Column(
101
                        'uploaded',
102
                        [
103
                            'type' => Column::TYPE_INTEGER,
104
                            'default' => "0",
105
                            'unsigned' => true,
106
                            'notNull' => true,
107
                            'size' => 1,
108
                            'after' => 'downloaded'
109
                        ]
110
                    ),
111
                    new Column(
112
                        'external',
113
                        [
114
                            'type' => Column::TYPE_INTEGER,
115
                            'default' => "0",
116
                            'unsigned' => true,
117
                            'notNull' => true,
118
                            'size' => 1,
119
                            'after' => 'uploaded'
120
                        ]
121
                    ),
122
                    new Column(
123
                        'status',
124
                        [
125
                            'type' => Column::TYPE_INTEGER,
126
                            'unsigned' => true,
127
                            'notNull' => false,
128
                            'size' => 2,
129
                            'after' => 'external'
130
                        ]
131
                    ),
132
                    new Column(
133
                        'created_date',
134
                        [
135
                            'type' => Column::TYPE_DATETIME,
136
                            'notNull' => false,
137
                            'after' => 'status'
138
                        ]
139
                    ),
140
                    new Column(
141
                        'updated_date',
142
                        [
143
                            'type' => Column::TYPE_DATETIME,
144
                            'notNull' => false,
145
                            'after' => 'created_date'
146
                        ]
147
                    ),
148
                    new Column(
149
                        'deleted',
150
                        [
151
                            'type' => Column::TYPE_INTEGER,
152
                            'default' => "0",
153
                            'unsigned' => true,
154
                            'notNull' => true,
155
                            'size' => 1,
156
                            'after' => 'updated_date'
157
                        ]
158
                    )
159
                ],
160
                'indexes' => [
161
                    new Index('PRIMARY', ['id'], 'PRIMARY'),
162
                    new Index('id_UNIQUE', ['id'], 'UNIQUE'),
163
                    new Index('id_index', ['id'], ''),
164
                    new Index('user_id_index', ['user_id'], ''),
165
                    new Index('mimetype_index', ['mimetype'], ''),
166
                    new Index('type_index', ['type'], ''),
167
                    new Index('completed_index', ['completed'], ''),
168
                    new Index('downloaded_index', ['downloaded'], ''),
169
                    new Index('uploaded_index', ['uploaded'], ''),
170
                    new Index('external_index', ['external'], ''),
171
                    new Index('status_index', ['status'], ''),
172
                    new Index('deleted_index', ['deleted'], '')
173
                ],
174
                'options' => [
175
                    'table_type' => 'BASE TABLE',
176
                    'auto_increment' => '',
177
                    'engine' => 'InnoDB',
178
                    'table_collation' => 'utf8mb4_general_ci'
179
                ],
180
            ]
181
        );
182
    }
183
184
    /**
185
     * Run the migrations
186
     *
187
     * @return void
188
     */
189
    public function up()
190
    {
191
192
    }
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...
193
194
    /**
195
     * Reverse the migrations
196
     *
197
     * @return void
198
     */
199
    public function down()
200
    {
201
202
    }
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...
203
204
}
205