m200823_094104_create_auth_client_table   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 3 1
A safeUp() 0 16 1
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