1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* m180618_143800_oauthRefreshTokens.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 m180618_143800_oauthRefreshTokens |
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 m180618_143800_oauthRefreshTokens extends Migration |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @inheritdoc |
33
|
|
|
*/ |
34
|
|
|
public function safeUp() |
35
|
|
|
{ |
36
|
|
|
$this->createTable('{{%oauthRefreshTokens}}', [ |
37
|
|
|
'id' => $this->string(255), |
38
|
|
|
'clientId' => $this->string(255), |
39
|
|
|
'userId' => $this->string(255), |
40
|
|
|
'expiry' => $this->dateTime(), |
41
|
|
|
'dateCreated' => $this->datetime(), |
42
|
|
|
'dateUpdated' => $this->datetime(), |
43
|
|
|
'dateDeleted' => $this->dateTime(), |
44
|
|
|
'PRIMARY KEY(id)', |
45
|
|
|
], 'ENGINE=InnoDB DEFAULT CHARSET=utf8'); |
46
|
|
|
$this->addForeignKey( |
47
|
|
|
'refreshTokens_clients_id_fk', |
48
|
|
|
'{{%oauthRefreshTokens}}', |
49
|
|
|
'clientId', |
50
|
|
|
'{{%oauthClients}}', |
51
|
|
|
'id', |
52
|
|
|
'SET NULL', |
53
|
|
|
'CASCADE' |
54
|
|
|
); |
55
|
|
|
return true; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @inheritdoc |
60
|
|
|
*/ |
61
|
|
|
public function safeDown() |
62
|
|
|
{ |
63
|
|
|
$this->dropForeignKey('refreshTokens_clients_id_fk', '{{%oauthRefreshTokens}}'); |
64
|
|
|
$this->dropTable('{{%oauthRefreshTokens}}'); |
65
|
|
|
return true; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
} |
69
|
|
|
|
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.