m200717_082932_create_user_table::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 9.8666
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `{{%user}}`.
7
 */
8
class m200717_082932_create_user_table extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createTable('{{%user}}', [
16
            'id' => $this->primaryKey(),
17
            'username' => $this->string(60)->notNull()->unique(),
18
            'avatar' => $this->string()->defaultValue(''),
19
            'email' => $this->string(120)->notNull()->unique(),
20
            'auth_key' => $this->string()->notNull(),
21
            'password_hash' => $this->string()->notNull(),
22
            'password_reset_token' => $this->string()->defaultValue(''),
23
            'status' => $this->tinyInteger()->defaultValue(0),
24
            'base_currency_code' => $this->string(3)->notNull(),
25
            'created_at' => $this->timestamp()->defaultValue(null),
26
            'updated_at' => $this->timestamp()->defaultValue(null),
27
        ]);
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function safeDown()
34
    {
35
        $this->dropTable('{{%user}}');
36
    }
37
}
38