Completed
Push — master ( 70482c...d02777 )
by Alexey
01:54
created

m130524_201442_init::up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 14
nc 2
nop 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A 0 19 2
1
<?php
2
namespace yiicod_auth_migrations;
3
4
use yii\db\Migration;
5
use yii\db\Schema;
6
7
class m130524_201442_init extends Migration
8
{
9
    public function up()
10
    {
11
        $tableOptions = null;
12
        if ($this->db->driverName === 'mysql') {
13
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
14
        }
15
16
        $this->createTable('{{%user}}', [
17
            'id' => Schema::TYPE_PK,
18
            'username' => Schema::TYPE_STRING . ' NOT NULL',
19
            'email' => Schema::TYPE_STRING . ' NOT NULL',
20
            'auth_Key' => Schema::TYPE_STRING . '(32) NOT NULL',
21
            'password_hash' => Schema::TYPE_STRING . ' NOT NULL',
22
            'password_reset_token' => Schema::TYPE_STRING,
23
            'status' => Schema::TYPE_SMALLINT . ' NOT NULL',
24
            'created_date' => Schema::TYPE_DATETIME . ' NOT NULL',
25
            'updated_date' => Schema::TYPE_DATETIME . ' NOT NULL',
26
        ], $tableOptions);
27
    }
28
29
    public function down()
30
    {
31
        $this->dropTable('{{%user}}');
32
    }
33
}
34