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