OauthTokensTable::change()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 15
c 1
b 0
f 1
dl 0
loc 17
rs 9.7666
cc 1
nc 1
nop 0
1
<?php
2
3
4
use Phinx\Migration\AbstractMigration;
5
6
class OauthTokensTable extends AbstractMigration
7
{
8
    /**
9
     * Change Method.
10
     *
11
     * Write your reversible migrations using this method.
12
     *
13
     * More information on writing migrations is available here:
14
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
15
     *
16
     * The following commands can be used in this method and Phinx will
17
     * automatically reverse them when rolling back:
18
     *
19
     *    createTable
20
     *    renameTable
21
     *    addColumn
22
     *    addCustomColumn
23
     *    renameColumn
24
     *    addIndex
25
     *    addForeignKey
26
     *
27
     * Any other destructive changes will result in an error when trying to
28
     * rollback the migration.
29
     *
30
     * Remember to call "create()" or "update()" and NOT "save()" when working
31
     * with the Table class.
32
     */
33
    public function change()
34
    {
35
        $table = $this->table('oauth_access_tokens');
36
        $table
37
            ->addColumn('identifier', 'string', ['limit' => 100])
38
            ->addColumn('user_id', 'string', ['limit' => 100])
39
            ->addColumn('client_id', 'string', ['limit' => 100])
40
            ->addColumn('name', 'string', [])
41
            ->addColumn('scopes', 'text', [])
42
            ->addColumn('revoked', 'boolean', [])
43
            ->addColumn('expires_at', 'datetime', ['null' => true])
44
            ->addColumn('created', 'datetime')
45
            ->addColumn('updated', 'datetime', ['null' => true])
46
            ->addIndex(['identifier'], ['unique' => true])
47
            ->addIndex(['user_id'], [])
48
            ->addIndex(['client_id'], [])
49
            ->create();
50
    }
51
}
52