m200717_082932_create_user_table   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 14 1
A safeDown() 0 3 1
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