m200823_094104_create_auth_client_table::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 16
rs 9.8666
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `{{%auth_client}}`.
7
 */
8
class m200823_094104_create_auth_client_table extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createTable('{{%auth_client}}', [
16
            'id' => $this->primaryKey(),
17
            'user_id' => $this->integer()->notNull(),
18
            'type' => $this->tinyInteger()->notNull(),
19
            'client_id' => $this->string()->notNull(),
20
            'client_username' => $this->string(),
21
            'data' => $this->text(),
22
            'status' => $this->tinyInteger()->notNull(),
23
            'created_at' => $this->timestamp()->defaultValue(null),
24
            'updated_at' => $this->timestamp()->defaultValue(null),
25
        ]);
26
27
        $this->createIndex('login_user_id_type', '{{%auth_client}}', ['user_id', 'type'], true);
28
        $this->createIndex('login_type_client_id', '{{%auth_client}}', ['type', 'client_id'], true);
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function safeDown()
35
    {
36
        $this->dropTable('{{%auth_client}}');
37
    }
38
}
39