Completed
Push — dev-master ( 50729f...83e592 )
by Vijay
04:16
created

OAuth2Apps   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 21 1
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
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