1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* m180622_131500_oauthScopeRefreshToken.php |
4
|
|
|
* PHP version 5.6+ |
5
|
|
|
* |
6
|
|
|
* Create applicants |
7
|
|
|
* |
8
|
|
|
* @author Maxime Deschamps <[email protected]> |
9
|
|
|
* @copyright 2010-2018 Ibitux |
10
|
|
|
* @license http://www.ibitux.com/license license |
11
|
|
|
* @version XXX |
12
|
|
|
* @link http://www.ibitux.com |
13
|
|
|
* @package src\migrations |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
use yii\db\Migration; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class m180622_131500_oauthScopeRefreshToken |
20
|
|
|
* |
21
|
|
|
* @author Maxime Deschamps <[email protected]> |
22
|
|
|
* @copyright 2010-2018 Ibitux |
23
|
|
|
* @license http://www.ibitux.com/license license |
24
|
|
|
* @version XXX |
25
|
|
|
* @link http://www.ibitux.com |
26
|
|
|
* @package src\migrations |
27
|
|
|
* @since XXX |
28
|
|
|
*/ |
29
|
|
|
class m180622_131500_oauthScopeRefreshToken extends Migration |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @inheritdoc |
33
|
|
|
*/ |
34
|
|
|
public function safeUp() |
35
|
|
|
{ |
36
|
|
|
$this->createTable('{{%oauthScopeRefreshToken}}', [ |
37
|
|
|
'scopeId' => $this->string(255), |
38
|
|
|
'refreshTokenId' => $this->string(255), |
39
|
|
|
'PRIMARY KEY(scopeId, refreshTokenId)', |
40
|
|
|
], 'ENGINE=InnoDB DEFAULT CHARSET=utf8'); |
41
|
|
|
$this->addForeignKey( |
42
|
|
|
'scope_refreshToken_scopes_id_fk', |
43
|
|
|
'{{%oauthScopeRefreshToken}}', |
44
|
|
|
'scopeId', |
45
|
|
|
'{{%oauthScopes}}', |
46
|
|
|
'id', |
47
|
|
|
'CASCADE', |
48
|
|
|
'CASCADE' |
49
|
|
|
); |
50
|
|
|
$this->addForeignKey( |
51
|
|
|
'scope_refreshToken_refreshTokens_id_fk', |
52
|
|
|
'{{%oauthScopeRefreshToken}}', |
53
|
|
|
'refreshTokenId', |
54
|
|
|
'{{%oauthRefreshTokens}}', |
55
|
|
|
'id', |
56
|
|
|
'CASCADE', |
57
|
|
|
'CASCADE' |
58
|
|
|
); |
59
|
|
|
return true; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @inheritdoc |
64
|
|
|
*/ |
65
|
|
|
public function safeDown() |
66
|
|
|
{ |
67
|
|
|
$this->dropForeignKey('scope_refreshToken_refreshTokens_id_fk', '{{%oauthScopeRefreshToken}}'); |
68
|
|
|
$this->dropForeignKey('scope_refreshToken_scopes_id_fk', '{{%oauthScopeRefreshToken}}'); |
69
|
|
|
$this->dropTable('{{%oauthScopeRefreshToken}}'); |
70
|
|
|
return true; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.