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

UsersData   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 13 1
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
class UsersData extends AbstractMigration
6
{
7
    /**
8
     * Create hash table 'users_data'
9
     */
10
    public function change()
11
    {
12
        $users = $this->table('users_data');
13
        $users->addColumn('uuid', 'string', ['comment' => 'UUID', 'limit' => 36])
14
              ->addColumn('users_uuid', 'string', ['comment' => 'User UUID', 'limit' => 36])
15
              ->addColumn('key', 'string', ['comment' => 'Key', 'limit' => 255])
16
              ->addColumn('value', 'text', ['comment' => 'Value', 'null' => true])
17
              ->addColumn('type', 'string', ['comment' => 'Type', 'limit' => 255])
18
              ->addIndex(['uuid'], ['unique' => true])
19
              ->addIndex(['users_uuid', 'key'], ['unique' => true])
20
              ->addForeignKey('users_uuid', 'users', 'uuid', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
21
              ->save();
22
    }
23
}
24