Passed
Pull Request — master (#4)
by
unknown
02:13
created

M171221000000WorkerLastExec   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 4 1
A safeDown() 0 4 1
1
<?php
2
/**
3
 * @link https://github.com/zhuravljov/yii2-queue-monitor
4
 * @copyright Copyright (c) 2017 Roman Zhuravlev
5
 * @license http://opensource.org/licenses/BSD-3-Clause
6
 */
7
8
namespace zhuravljov\yii\queue\monitor\migrations;
9
10
use zhuravljov\yii\queue\monitor\base\Migration;
11
12
/**
13
 * Storage of worker events
14
 *
15
 * @author Roman Zhuravlev <[email protected]>
16
 */
17
class M171221000000WorkerLastExec extends Migration
18
{
19
    /**
20
     * @inheritdoc
21
     */
22
    public function safeUp()
23
    {
24
        $this->addColumn($this->env->workerTableName, 'last_exec_id', $this->integer());
25
        $this->createIndex('last_exec_id', $this->env->workerTableName, 'last_exec_id');
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function safeDown()
32
    {
33
        $this->dropIndex('last_exec_id', $this->env->workerTableName);
34
        $this->dropColumn($this->env->workerTableName, 'last_exec_id');
35
    }
36
}
37