Completed
Pull Request — devel (#18)
by
unknown
37:50
created

m180618_132000_oauthScopeClient::safeUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 27
rs 9.488
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * m180618_132000_oauth_scopeClient.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_132000_oauth_scopeClient
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_132000_oauthScopeClient 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('{{%oauthScopeClient}}', [
38
            'scopeId' => $this->string(255),
39
            'clientId' => $this->string(255),
40
            'PRIMARY KEY(scopeId, clientId)',
41
        ], 'ENGINE=InnoDB DEFAULT CHARSET=utf8');
42
        $this->addForeignKey(
43
            'scope_client_scopes_id_fk',
44
            '{{%oauthScopeClient}}',
45
            'scopeId',
46
            '{{%oauthScopes}}',
47
            'id',
48
            'CASCADE',
49
            'CASCADE'
50
        );
51
        $this->addForeignKey(
52
            'scope_client_clients_id_fk',
53
            '{{%oauthScopeClient}}',
54
            'clientId',
55
            '{{%oauthClients}}',
56
            'id',
57
            'CASCADE',
58
            'CASCADE'
59
        );
60
        return true;
61
    }
62
63
    /**
64
     * @inheritdoc
65
     */
66
    public function safeDown()
67
    {
68
        $this->dropForeignKey('scope_client_clients_id_fk', '{{%oauthScopeClient}}');
69
        $this->dropForeignKey('scope_client_scopes_id_fk', '{{%oauthScopeClient}}');
70
        $this->dropTable('{{%oauthScopeClient}}');
71
        return true;
72
    }
73
74
}
75