m130524_201442_init   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 27
rs 10

2 Methods

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