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

m170920_170000_queue_updated::down()   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 14
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 Dmytro Naumenko <[email protected]>
19
 */
20
class m170920_170000_queue_updated extends Migration
21
{
22
    public $tableName = '{{%queue}}';
23
24
    public function up()
25
    {
26
        $this->dropTable($this->tableName);
27
        $this->createTable($this->tableName, [
28
            'id' => $this->primaryKey(),
29
            'channel' => $this->string()->notNull(),
30
            'job' => $this->binary()->notNull(),
31
            'pushed_at' => $this->integer()->notNull(),
32
            'ttr' => $this->integer()->notNull(),
33
            'delay' => $this->integer()->notNull(),
34
            'priority' => $this->integer()->unsigned()->notNull()->defaultValue(1024),
35
            'reserved_at' => $this->integer(),
36
            'attempt' => $this->integer(),
37
            'done_at' => $this->integer(),
38
        ]);
39
        $this->createIndex('channel', $this->tableName, 'channel');
40
        $this->createIndex('reserved_at', $this->tableName, 'reserved_at');
41
        $this->createIndex('priority', $this->tableName, 'priority');
42
    }
43
44 View Code Duplication
    public function down()
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...
45
    {
46
        $this->dropTable($this->tableName);
47
        $this->createTable($this->tableName, [
48
            'id' => $this->primaryKey(),
49
            'channel' => $this->string()->notNull(),
50
            'job' => $this->binary()->notNull(),
51
            'created_at' => $this->integer()->notNull(),
52
            'started_at' => $this->integer(),
53
            'finished_at' => $this->integer(),
54
        ]);
55
        $this->createIndex('channel', $this->tableName, 'channel');
56
        $this->createIndex('started_at', $this->tableName, 'started_at');
57
    }
58
}
59