m000000_000006_add_two_factor_fields   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 9 1
A safeDown() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-usuario project.
5
 *
6
 * (c) 2amigOS! <http://2amigos.us/>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace Da\User\Migration;
13
14
use Da\User\Helper\MigrationHelper;
15
use yii\db\Migration;
16
17
class m000000_000006_add_two_factor_fields extends Migration
18
{
19
    public function safeUp()
20
    {
21
        $this->addColumn('{{%user}}', 'auth_tf_key', $this->string(16));
22
        $this->addColumn(
23
            '{{%user}}',
24
            'auth_tf_enabled',
25
            $this->boolean()->defaultValue(MigrationHelper::getBooleanValue($this->db->driverName))
26
        );
27
    }
28
29
    public function safeDown()
30
    {
31
        $this->dropColumn('{{%user}}', 'auth_tf_key');
32
        $this->dropColumn('{{%user}}', 'auth_tf_enabled');
33
    }
34
}
35