Completed
Push — dev-master ( 50729f...83e592 )
by Vijay
04:16
created

Reports::change()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 14
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 16
rs 9.4285
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
class Reports extends AbstractMigration
6
{
7
    /**
8
    * Create OAuth2 application tokens table
9
      */
10
    public function change()
11
    {
12
        $oauthTokens = $this->table('reports');
13
        $oauthTokens->addColumn('uuid', 'string', ['comment' => 'UUID', 'limit' => 36, 'null' => false])
14
              ->addColumn('users_uuid', 'string', ['comment' => 'User UUID', 'limit' => 36])
15
              ->addColumn('groups', 'string', ['comment' => 'Account Groups', 'limit' => 64, 'default' => 'user'])
16
              ->addColumn('key', 'string', ['comment' => 'Key', 'limit' => 255])
17
              ->addColumn('name', 'string', ['comment' => 'Name', 'limit' => 255])
18
              ->addColumn('description', 'text', ['comment' => 'Description', 'null' => true])
19
              ->addColumn('query', 'text', ['comment' => 'Query', 'null' => true])
20
              ->addColumn('options', 'text', ['comment' => 'Extra Options', 'null' => true])
21
              ->addColumn('created', 'datetime', ['comment' => 'Created'])
22
              ->addIndex(['uuid'], ['unique' => true])
23
              ->addForeignKey('users_uuid', 'users', 'uuid', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
24
              ->save();
25
    }
26
}
27