Test Failed
Push — master ( a6b51e...5fffdb )
by Gabriel
08:05
created

OauthRefreshTokensTable::change()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
4
use Phinx\Migration\AbstractMigration;
5
6
class OauthRefreshTokensTable extends AbstractMigration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
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_refresh_tokens');
36
        $table
37
            ->addColumn('identifier', 'string', ['limit' => 100])
38
            ->addColumn('access_token_id', 'integer', [])
39
            ->addColumn('expires_at', 'datetime', ['null' => true])
40
            ->addColumn('created', 'datetime')
41
            ->addColumn('updated', 'datetime', ['null' => true])
42
            ->addIndex(['identifier'], ['unique' => true])
43
            ->addIndex(['access_token_id'], [])
44
            ->create();
45
    }
46
}
47