OauthClientsTable   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 13
c 1
b 0
f 1
dl 0
loc 42
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 15 1
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