m140825_112820_elastic_init::up()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
use yii\db\Schema;
4
/**
5
 * @inheritdoc
6
 * @SuppressWarnings(ShortMethodName)
7
 * @SuppressWarnings(CamelCaseClassName)
8
 */
9
class m140825_112820_elastic_init extends \yii\db\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...
10
{
11
    /**
12
     * @inheritdoc
13
     */
14
    public function up()
15
    {
16
        $tableOptions = null;
17
        if ($this->db->driverName === 'mysql') {
18
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
19
        }
20
21
        $this->createTable('ym_elastic_spool_item', [
22
            'id' => Schema::TYPE_INTEGER . '(10) UNSIGNED NOT NULL AUTO_INCREMENT',
23
            'model_class' => Schema::TYPE_STRING . '(256) NOT NULL',
24
            'record_id' => Schema::TYPE_INTEGER . '(10) UNSIGNED NOT NULL',
25
            'action_code' => Schema::TYPE_STRING . '(32) NOT NULL',
26
            'is_processing' => 'tinyint(1) NOT NULL',
27
            'PRIMARY KEY (`id`)',
28
        ], $tableOptions);
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function down()
35
    {
36
        $this->dropTable('ym_elastic_spool_item');
37
    }
38
}
39