m171103_042857_queue::up()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
use yii\db\Migration;
4
5
class m171103_042857_queue extends Migration
6
{
7
    public function up()
8
    {
9
        $tableOptions = null;
10
        if ($this->db->driverName === 'mysql') {
11
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
12
        }
13
        $this->createTable('{{%queue}}', [
14
            'id' => $this->primaryKey(),
15
            'queue_id' => $this->integer()->notNull()->comment('队列id'),
16
            'catalog' => $this->string()->comment('类别'),
17
            'name' => $this->string()->notNull()->comment('任务名称'),
18
            'description' => $this->text()->comment('详请信息'),
19
            'log' => $this->text()->comment('错误日志'),
20
            'exec_time' => $this->integer()->comment('执行时间'),
21
            'created_at' => $this->integer()->comment('队列创建时间'),
22
            'updated_at' => $this->integer()->comment('队列执行时间'),
23
        ], $tableOptions);
24
    }
25
26
    public function down()
27
    {
28
        $this->dropTable('{{%queue}}');
29
    }
30
}
31