Completed
Push — master ( 052b79...9b7d7f )
by Dmitry
08:01
created

m161129_140000_queue::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 14
loc 14
ccs 0
cts 13
cp 0
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Asset Packagist.
4
 *
5
 * @link      https://github.com/hiqdev/asset-packagist
6
 * @package   asset-packagist
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\assetpackagist\migrations;
12
13
use yii\db\Migration;
14
15
/**
16
 * Migration for queue message storage.
17
 *
18
 * @author Roman Zhuravlev <[email protected]>
19
 */
20
class m161129_140000_queue extends Migration
21
{
22
    public $tableName = '{{%queue}}';
23
    public $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
24
25 View Code Duplication
    public function up()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
    {
27
        $this->createTable($this->tableName, [
28
            'id' => $this->primaryKey(),
29
            'channel' => $this->string()->notNull(),
30
            'job' => $this->binary()->notNull(),
31
            'created_at' => $this->integer()->notNull(),
32
            'started_at' => $this->integer(),
33
            'finished_at' => $this->integer(),
34
        ], $this->tableOptions);
35
36
        $this->createIndex('channel', $this->tableName, 'channel');
37
        $this->createIndex('started_at', $this->tableName, 'started_at');
38
    }
39
40
    public function down()
41
    {
42
        $this->dropTable($this->tableName);
43
    }
44
}
45