Completed
Pull Request — devel (#18)
by Maxime
37:07
created

m180618_113800_oauthJtis   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 42
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 25 1
A safeDown() 0 6 1
1
<?php
2
/**
3
 * m180618_113800_oauthJtis.php
4
 *
5
 * PHP version 5.6+
6
 *
7
 * Create applicants
8
 *
9
 * @author Maxime Deschamps <[email protected]>
10
 * @copyright 2010-2018 Ibitux
11
 * @license http://www.ibitux.com/license license
12
 * @version XXX
13
 * @link http://www.ibitux.com
14
 * @package src\migrations
15
 */
16
17
use yii\db\Migration;
18
19
/**
20
 * Class m180618_113800_oauthJtis
21
 *
22
 * @author Maxime Deschamps <[email protected]>
23
 * @copyright 2010-2018 Ibitux
24
 * @license http://www.ibitux.com/license license
25
 * @version XXX
26
 * @link http://www.ibitux.com
27
 * @package src\migrations
28
 * @since XXX
29
 */
30
class m180618_113800_oauthJtis extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
31
{
32
    /**
33
     * @inheritdoc
34
     */
35
    public function safeUp()
36
    {
37
        $this->createTable('{{%oauthJtis}}', [
38
            'id' => $this->string(255),
39
            'clientId' => $this->string(255),
40
            'subject' => $this->string(255),
41
            'audience' => $this->string(255),
42
            'expires' => $this->dateTime(),
43
            'jti' => $this->text(),
44
            'dateCreated' => $this->datetime(),
45
            'dateUpdated' => $this->datetime(),
46
            'dateDeleted' => $this->dateTime(),
47
            'PRIMARY KEY(id)',
48
        ], 'ENGINE=InnoDB DEFAULT CHARSET=utf8');
49
        $this->addForeignKey(
50
            'jtis_clients_id_fk',
51
            '{{%oauthJtis}}',
52
            'clientId',
53
            '{{%oauthClients}}',
54
            'id',
55
            'SET NULL',
56
            'CASCADE'
57
        );
58
        return true;
59
    }
60
61
    /**
62
     * @inheritdoc
63
     */
64
    public function safeDown()
65
    {
66
        $this->dropForeignKey('jtis_clients_id_fk', '{{%oauthJtis}}');
67
        $this->dropTable('{{%oauthJtis}}');
68
        return true;
69
    }
70
71
}
72