1 | <?php |
||
5 | class OAuth2Apps extends AbstractMigration |
||
6 | { |
||
7 | /** |
||
8 | * Create OAuth2 application table |
||
9 | */ |
||
10 | public function change() |
||
11 | { |
||
12 | $oauthApps = $this->table('oauth2_apps'); |
||
13 | $oauthApps->addColumn('created', 'datetime', ['comment' => 'Created']) |
||
14 | ->addColumn('users_uuid', 'string', ['comment' => 'User UUID', 'limit' => 36]) |
||
15 | ->addColumn('client_id', 'string', ['comment' => 'Client Id', 'limit' => 36]) |
||
16 | ->addColumn('client_secret', 'string', ['comment' => 'Client Secret', 'limit' => 36]) |
||
17 | ->addColumn('name', 'string', ['comment' => 'Application Name', 'limit' => 255]) |
||
18 | ->addColumn('logo_url', 'text', ['comment' => 'Logo Image URL', 'limit' => 1024, 'null' => true]) |
||
19 | ->addColumn('description', 'text', ['comment' => 'Description', 'null' => true]) |
||
20 | ->addColumn('scope', 'text', ['comment' => 'Allowed Scopes', 'null' => true]) |
||
21 | ->addColumn('callback_uri', 'text', ['comment' => 'Callback URI', 'null' => true]) |
||
22 | ->addColumn('redirect_uris', 'text', ['comment' => 'Redirect URIs', 'null' => true]) |
||
23 | ->addColumn('status', 'string', ['comment' => 'Status', 'limit' => 16, 'default' => 'NEW']) |
||
24 | ->addIndex(['name'], ['unique' => true]) |
||
25 | ->addIndex(['client_id'], ['unique' => true]) |
||
26 | ->addIndex(['client_secret'], ['unique' => true]) |
||
27 | ->addIndex(['client_id', 'client_secret'], ['unique' => true]) |
||
28 | ->addForeignKey('users_uuid', 'users', 'uuid', ['delete'=> 'CASCADE', 'update'=> 'CASCADE']) |
||
29 | ->save(); |
||
30 | } |
||
31 | } |
||
32 |