m130524_201442_init::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 3
c 1
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
use yii\db\Schema;
4
5
class m130524_201442_init extends \yii\db\Migration
6
{
7
    public function up()
8
    {
9
        $tableOptions = null;
10
        if ($this->db->driverName === 'mysql') {
11
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
12
        }
13
14
        $this->createTable('{{%user}}', [
15
            'id' => Schema::TYPE_PK,
16
            'username' => Schema::TYPE_STRING . ' NOT NULL',
17
            'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL',
18
            'password_hash' => Schema::TYPE_STRING . ' NOT NULL',
19
            'password_reset_token' => Schema::TYPE_STRING,
20
            'email' => Schema::TYPE_STRING . ' NOT NULL',
21
            'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10',
22
23
            'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10',
24
            'created_at' => Schema::TYPE_INTEGER . ' NOT NULL',
25
            'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL',
26
        ], $tableOptions);
27
    }
28
29
    public function down()
30
    {
31
        $this->dropTable('{{%user}}');
32
    }
33
}
34