Completed
Push — feature/controller ( c1e929...90cc1a )
by René
02:29
created

UserInit   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B change() 0 31 1
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
/**
6
 * Class UserInit
7
 */
8
class UserInit 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
12
     */
13
    public function change()
14
    {
15
        /**
16
         * users
17
         */
18
        $users = $this->table('users', ['collation' => 'utf8mb4_unicode_ci']);
19
20
        $users->addColumn('email', 'string', ['length' => 128]);
21
        $users->addColumn('password_hash', 'string', ['length' => 255]);
22
        $users->addColumn('modified', 'datetime');
23
        $users->addColumn('created', 'datetime');
24
25
        $users->create();
26
27
        $users->changeColumn('id', 'integer', ['signed' => false, 'identity' => true]);
28
        $users->update();
29
30
        /**
31
         * user_password_resets
32
         */
33
        $users = $this->table('user_password_resets', ['collation' => 'utf8mb4_unicode_ci']);
34
35
        $users->addColumn('user_id', 'integer', ['signed' => false]);
36
        $users->addColumn('token_hash', 'string', ['length' => 255]);
37
        $users->addColumn('created', 'datetime');
38
39
        $users->create();
40
41
        $users->changeColumn('id', 'integer', ['signed' => false, 'identity' => true]);
42
        $users->update();
43
    }
44
}
45