|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Phinx\Migration\AbstractMigration; |
|
4
|
|
|
|
|
5
|
|
|
class Reports extends AbstractMigration |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Create OAuth2 application tokens table |
|
9
|
|
|
*/ |
|
10
|
|
|
public function change() |
|
11
|
|
|
{ |
|
12
|
|
|
$oauthTokens = $this->table('reports'); |
|
13
|
|
|
$oauthTokens->addColumn('uuid', 'string', ['comment' => 'UUID', 'limit' => 36, 'null' => false]) |
|
14
|
|
|
->addColumn('users_uuid', 'string', ['comment' => 'User UUID', 'limit' => 36]) |
|
15
|
|
|
->addColumn('groups', 'string', ['comment' => 'Account Groups', 'limit' => 64, 'default' => 'user']) |
|
16
|
|
|
->addColumn('key', 'string', ['comment' => 'Key', 'limit' => 255]) |
|
17
|
|
|
->addColumn('name', 'string', ['comment' => 'Name', 'limit' => 255]) |
|
18
|
|
|
->addColumn('description', 'text', ['comment' => 'Description', 'null' => true]) |
|
19
|
|
|
->addColumn('query', 'text', ['comment' => 'Query', 'null' => true]) |
|
20
|
|
|
->addColumn('options', 'text', ['comment' => 'Extra Options', 'null' => true]) |
|
21
|
|
|
->addColumn('created', 'datetime', ['comment' => 'Created']) |
|
22
|
|
|
->addIndex(['uuid'], ['unique' => true]) |
|
23
|
|
|
->addForeignKey('users_uuid', 'users', 'uuid', ['delete'=> 'CASCADE', 'update'=> 'CASCADE']) |
|
24
|
|
|
->save(); |
|
25
|
|
|
} |
|
26
|
|
|
} |
|
27
|
|
|
|