Passed
Push — master ( e0e6c6...849d03 )
by Roman
02:16
created

M180310000000StorageRefactoring   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 6 1
A safeUp() 0 6 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 Refactoring
14
 *
15
 * @author Roman Zhuravlev <[email protected]>
16
 */
17
class M180310000000StorageRefactoring extends Migration
18
{
19
    /**
20
     * @inheritdoc
21
     */
22
    public function safeUp()
23
    {
24
        $this->renameColumn($this->env->pushTableName, 'ttr', 'push_ttr');
25
        $this->renameColumn($this->env->pushTableName, 'delay', 'push_delay');
26
        $this->addColumn($this->env->pushTableName, 'push_trace_data', $this->binary()->after('push_delay'));
27
        $this->addColumn($this->env->pushTableName, 'push_env_data', $this->binary()->after('push_trace_data'));
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33
    public function safeDown()
34
    {
35
        $this->dropColumn($this->env->pushTableName, 'push_env_data');
36
        $this->dropColumn($this->env->pushTableName, 'push_trace_data');
37
        $this->renameColumn($this->env->pushTableName, 'push_delay', 'delay');
38
        $this->renameColumn($this->env->pushTableName, 'push_ttr', 'ttr');
39
    }
40
}
41