Completed
Pull Request — master (#5)
by Angel
22:53 queued 02:51
created

m140501_075313_oauth_refresh_tokens::foreignKeys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
use roaresearch\yii2\oauth2server\migrations\tables\CreateTable;
4
5
class m140501_075313_oauth_refresh_tokens extends CreateTable
6
{
7
    /**
8
     * @inheritdoc
9
     */
10
    public function getTableName(): string
11
    {
12
        return 'oauth_refresh_tokens';
13
    }
14
15
    /**
16
     * @inheritdoc
17
     */
18
    public function columns(): array
19
    {
20
        return [
21
            'refresh_token' => $this->primaryKey(40),
22
            'client_id' => $this->string(32)->notNull(),
23
            'user_id' => $this->integer()->defaultValue(null),
24
            'expires' => $this->datetime()->notNull(),
25
            'scope' => $this->string(2000)->notNull()->defaultValue(null),
26
        ];
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function foreignKeys(): array
33
    {
34
        return [
35
            'client_id' => [
36
                'table' => 'oauth_clients',
37
                'columns' => ['client_id' => 'client_id'],
38
            ],
39
        ];
40
    }
41
}
42