m180126_183432_create_user_table::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 11
rs 9.9666
c 1
b 0
f 0
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `user`.
7
 */
8
class m180126_183432_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()->notNull(),
18
            'email' => $this->string()->notNull(),
19
            'image' => $this->string(),
20
            'google_user_id' => $this->string()->notNull(),
21
            'active' => $this->boolean()->notNull()->defaultValue(0),
22
            'updated_at' => $this->dateTime(),
23
            'created_at' => $this->dateTime(),
24
        ]);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function safeDown()
31
    {
32
        $this->dropTable('user');
33
    }
34
}
35