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

UserInit::change()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
rs 8.8571
cc 1
eloc 16
nc 1
nop 0
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