Completed
Push — master ( fe783a...4f5411 )
by Nate
16:36 queued 09:40
created

m180507_121214_user_association_sort::safeDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
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\UserAssociation;
13
14
/**
15
 * This migration adds a new column to support multiple user association sort types.
16
 */
17
class m180507_121214_user_association_sort extends Migration
18
{
19
    /**
20
     * @return bool|void
21
     */
22
    public function safeUp()
23
    {
24
        $this->renameColumn(
25
            UserAssociation::tableName(),
26
            'sortOrder',
27
            'organizationOrder'
28
        );
29
30
        $this->addColumn(
31
            UserAssociation::tableName(),
32
            'userOrder',
33
            $this->smallInteger()->unsigned()
34
        );
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function safeDown()
41
    {
42
        echo "m180507_1212141_user_association_sort cannot be reverted.\n";
43
        return false;
44
    }
45
}
46