Completed
Push — master ( 5a29a0...22ab66 )
by Dmitry
10:00
created

m161129_140000_queue::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace hiqdev\assetpackagist\migrations;
4
5
use yii\db\Migration;
6
7
/**
8
 * Migration for queue message storage
9
 *
10
 * @author Roman Zhuravlev <[email protected]>
11
 */
12
class m161129_140000_queue extends Migration
13
{
14
    public $tableName = '{{%queue}}';
15
    public $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
16
17
    public function up()
18
    {
19
        $this->createTable($this->tableName, [
20
            'id' => $this->primaryKey(),
21
            'channel' => $this->string()->notNull(),
22
            'job' => $this->binary()->notNull(),
23
            'created_at' => $this->integer()->notNull(),
24
            'started_at' => $this->integer(),
25
            'finished_at' => $this->integer(),
26
        ], $this->tableOptions);
27
28
        $this->createIndex('channel', $this->tableName, 'channel');
29
        $this->createIndex('started_at', $this->tableName, 'started_at');
30
    }
31
32
    public function down()
33
    {
34
        $this->dropTable($this->tableName);
35
    }
36
}
37