m000000_000009_add_gdpr_consent_fields::safeDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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_000009_add_gdpr_consent_fields extends Migration
18
{
19
    public function safeUp()
20
    {
21
        $this->addColumn('{{%user}}', 'gdpr_consent', $this->boolean()->defaultValue(MigrationHelper::getBooleanValue($this->db->driverName, false)));
22
        $this->addColumn('{{%user}}', 'gdpr_consent_date', $this->integer(11)->null());
23
        $this->addColumn('{{%user}}', 'gdpr_deleted', $this->boolean()->defaultValue(MigrationHelper::getBooleanValue($this->db->driverName, false)));
24
    }
25
26
    public function safeDown()
27
    {
28
        $this->dropColumn('{{%user}}', 'gdpr_consent');
29
        $this->dropColumn('{{%user}}', 'gdpr_consent_date');
30
        $this->dropColumn('{{%user}}', 'gdpr_deleted');
31
    }
32
}
33