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