1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
use Phinx\Migration\AbstractMigration; |
5
|
|
|
|
6
|
|
|
class OauthTokensTable extends AbstractMigration |
7
|
|
|
{ |
8
|
|
|
/** |
9
|
|
|
* Change Method. |
10
|
|
|
* |
11
|
|
|
* Write your reversible migrations using this method. |
12
|
|
|
* |
13
|
|
|
* More information on writing migrations is available here: |
14
|
|
|
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class |
15
|
|
|
* |
16
|
|
|
* The following commands can be used in this method and Phinx will |
17
|
|
|
* automatically reverse them when rolling back: |
18
|
|
|
* |
19
|
|
|
* createTable |
20
|
|
|
* renameTable |
21
|
|
|
* addColumn |
22
|
|
|
* addCustomColumn |
23
|
|
|
* renameColumn |
24
|
|
|
* addIndex |
25
|
|
|
* addForeignKey |
26
|
|
|
* |
27
|
|
|
* Any other destructive changes will result in an error when trying to |
28
|
|
|
* rollback the migration. |
29
|
|
|
* |
30
|
|
|
* Remember to call "create()" or "update()" and NOT "save()" when working |
31
|
|
|
* with the Table class. |
32
|
|
|
*/ |
33
|
|
|
public function change() |
34
|
|
|
{ |
35
|
|
|
$table = $this->table('oauth_access_tokens'); |
36
|
|
|
$table |
37
|
|
|
->addColumn('identifier', 'string', ['limit' => 100]) |
38
|
|
|
->addColumn('user_id', 'string', ['limit' => 100]) |
39
|
|
|
->addColumn('client_id', 'string', ['limit' => 100]) |
40
|
|
|
->addColumn('name', 'string', []) |
41
|
|
|
->addColumn('scopes', 'text', []) |
42
|
|
|
->addColumn('revoked', 'boolean', []) |
43
|
|
|
->addColumn('expires_at', 'datetime', ['null' => true]) |
44
|
|
|
->addColumn('created', 'datetime') |
45
|
|
|
->addColumn('updated', 'datetime', ['null' => true]) |
46
|
|
|
->addIndex(['identifier'], ['unique' => true]) |
47
|
|
|
->addIndex(['user_id'], []) |
48
|
|
|
->addIndex(['client_id'], []) |
49
|
|
|
->create(); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|