m180616_081006_remove_state_column   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 10 2
A safeDown() 0 5 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/organization/license
6
 * @link       https://www.flipboxfactory.com/software/organization/
7
 */
8
9
namespace flipbox\organizations\migrations;
10
11
use craft\db\Migration;
12
use flipbox\organizations\records\Organization as OrganizationRecord;
13
14
/**
15
 * This migration removes the 'state' column from elements record.
16
 */
17
class m180616_081006_remove_state_column extends Migration
18
{
19
    /**
20
     * @inheritdoc
21
     * @throws \yii\base\NotSupportedException
22
     */
23
    public function safeUp()
24
    {
25
        $table = $this->getDb()->getSchema()->getTableSchema(
26
            OrganizationRecord::tableName()
27
        );
28
29
        if (isset($table->columns['state'])) {
30
            $this->dropColumn(OrganizationRecord::tableName(), 'state');
31
        }
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function safeDown()
38
    {
39
        echo "m180616_081006_remove_state_column cannot be reverted.\n";
40
        return true;
41
    }
42
}
43