CreatePermission   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 8
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 10 1
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
/**
6
 * Class CreatePermission
7
 */
8
class CreatePermission extends AbstractMigration
9
{
10
    /**
11
     * Create permission table in database.
12
     * Field 'name' is unique index.
13
     */
14
    public function change()
15
    {
16
        $permissionTable = $this->table('permission', ['signed' => false]);
17
18
        $permissionTable->addColumn('name', 'string', ['limit' => 100])
19
            ->addColumn('status', 'boolean', ['default' => true])
20
            ->addColumn('created_at', 'datetime')
21
            ->addColumn('updated_at', 'datetime', ['null' => true])
22
            ->addIndex('name', ['name' => 'idx_permission_name' ,'unique' => true])
23
            ->create();
24
    }
25
}
26