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

FileMigration_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 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
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 FileMigration_100
10
 */
11
class FileMigration_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 "FileMigration_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('file', [
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
                        'key',
45
                        [
46
                            'type' => Column::TYPE_VARCHAR,
47
                            'notNull' => false,
48
                            'size' => 191,
49
                            'after' => 'user_id'
50
                        ]
51
                    ),
52
                    new Column(
53
                        'path',
54
                        [
55
                            'type' => Column::TYPE_VARCHAR,
56
                            'notNull' => false,
57
                            'size' => 191,
58
                            'after' => 'key'
59
                        ]
60
                    ),
61
                    new Column(
62
                        'type',
63
                        [
64
                            'type' => Column::TYPE_VARCHAR,
65
                            'notNull' => false,
66
                            'size' => 191,
67
                            'after' => 'path'
68
                        ]
69
                    ),
70
                    new Column(
71
                        'type_real',
72
                        [
73
                            'type' => Column::TYPE_VARCHAR,
74
                            'notNull' => false,
75
                            'size' => 120,
76
                            'after' => 'type'
77
                        ]
78
                    ),
79
                    new Column(
80
                        'extension',
81
                        [
82
                            'type' => Column::TYPE_CHAR,
83
                            'notNull' => false,
84
                            'size' => 6,
85
                            'after' => 'type_real'
86
                        ]
87
                    ),
88
                    new Column(
89
                        'name',
90
                        [
91
                            'type' => Column::TYPE_VARCHAR,
92
                            'notNull' => false,
93
                            'size' => 191,
94
                            'after' => 'extension'
95
                        ]
96
                    ),
97
                    new Column(
98
                        'name_temp',
99
                        [
100
                            'type' => Column::TYPE_VARCHAR,
101
                            'notNull' => false,
102
                            'size' => 191,
103
                            'after' => 'name'
104
                        ]
105
                    ),
106
                    new Column(
107
                        'size',
108
                        [
109
                            'type' => Column::TYPE_VARCHAR,
110
                            'notNull' => false,
111
                            'size' => 45,
112
                            'after' => 'name_temp'
113
                        ]
114
                    ),
115
                    new Column(
116
                        'error',
117
                        [
118
                            'type' => Column::TYPE_TEXT,
119
                            'notNull' => false,
120
                            'after' => 'size'
121
                        ]
122
                    ),
123
                    new Column(
124
                        'created_date',
125
                        [
126
                            'type' => Column::TYPE_DATETIME,
127
                            'notNull' => false,
128
                            'after' => 'error'
129
                        ]
130
                    ),
131
                    new Column(
132
                        'deleted',
133
                        [
134
                            'type' => Column::TYPE_INTEGER,
135
                            'unsigned' => true,
136
                            'notNull' => true,
137
                            'size' => 1,
138
                            'after' => 'created_date'
139
                        ]
140
                    )
141
                ],
142
                'indexes' => [
143
                    new Index('PRIMARY', ['id'], 'PRIMARY'),
144
                    new Index('id_UNIQUE', ['id'], 'UNIQUE'),
145
                    new Index('deleted_index', ['deleted'], ''),
146
                    new Index('id_index', ['id'], ''),
147
                    new Index('user_id_index', ['user_id'], '')
148
                ],
149
                'references' => [
150
                    new Reference(
151
                        'file_user_id_fk',
152
                        [
153
                            'referencedTable' => 'user',
154
                            'referencedSchema' => 'zemit',
155
                            'columns' => ['user_id'],
156
                            'referencedColumns' => ['id'],
157
                            'onUpdate' => 'CASCADE',
158
                            'onDelete' => 'SET NULL'
159
                        ]
160
                    )
161
                ],
162
                'options' => [
163
                    'table_type' => 'BASE TABLE',
164
                    'auto_increment' => '',
165
                    'engine' => 'InnoDB',
166
                    'table_collation' => 'utf8mb4_general_ci'
167
                ],
168
            ]
169
        );
170
    }
171
172
    /**
173
     * Run the migrations
174
     *
175
     * @return void
176
     */
177
    public function up()
178
    {
179
180
    }
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...
181
182
    /**
183
     * Reverse the migrations
184
     *
185
     * @return void
186
     */
187
    public function down()
188
    {
189
190
    }
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...
191
192
}
193