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

OauthClientsTable::change()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
/**
6
 * Class OauthClientsTable
7
 */
8
class OauthClientsTable 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...
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