Completed
Push — master ( 050600...86bb02 )
by Antonio
04:26 queued 02:22
created

m000000_000001_create_user_table::safeDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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_000001_create_user_table extends Migration
18
{
19
    public function safeUp()
20
    {
21
        $this->createTable(
22
            '{{%user}}',
23
            [
24
                'id' => $this->primaryKey(),
25
                'username' => $this->string(255)->notNull(),
26
                'email' => $this->string(255)->notNull(),
27
                'password_hash' => $this->string(60)->notNull(),
28
                'auth_key' => $this->string(32)->notNull(),
29
                'unconfirmed_email' => $this->string(255),
30
                'registration_ip' => $this->string(45),
31
                'flags' => $this->integer()->notNull()->defaultValue('0'),
32
                'confirmed_at' => $this->integer(),
33
                'blocked_at' => $this->integer(),
34
                'updated_at' => $this->integer()->notNull(),
35
                'created_at' => $this->integer()->notNull(),
36
            ],
37
            MigrationHelper::resolveTableOptions($this->db->driverName)
38
        );
39
40
        $this->createIndex('idx_user_username', '{{%user}}', 'username', true);
41
        $this->createIndex('idx_user_email', '{{%user}}', 'email', true);
42
    }
43
44
    public function safeDown()
45
    {
46
        $this->dropTable('{{%user}}');
47
    }
48
}
49