Passed
Push — master ( 620198...96468c )
by Wilmer
02:04
created

m000000_000002_create_user_tests_table::up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 14
nc 2
nop 0
dl 0
loc 20
rs 9.7998
c 1
b 0
f 0
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * m000000_000002_create_user_tests_table is the migrations Web Application Basic.
7
 */
8
class m000000_000002_create_user_tests_table extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function up()
14
    {
15
		$tableOptions = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $tableOptions is dead and can be removed.
Loading history...
16
17
		if ($this->db->driverName === 'mysql') {
18
			// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
19
			$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
20
		}
21
22
        $this->createTable('user_test', [
23
			'id' =>$this->primaryKey(),
24
			'username' =>$this->string()->notNull()->unique(),
25
			'auth_key' =>$this->string(32)->notNull(),
26
			'password_hash' =>$this->string()->notNull(),
27
			'password_reset_token' =>$this->string()->unique(),
28
            'email' =>$this->string()->notNull()->unique(),
29
            'role' =>$this->smallInteger()->notNull()->defaultValue(10),
30
			'status' =>$this->smallInteger()->notNull()->defaultValue(10),
31
			'created_at' =>$this->integer()->notNull(),
32
			'updated_at' =>$this->integer()->notNull(),
33
        ]);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function down()
40
    {
41
        $this->dropTable('user_test');
42
    }
43
}
44