Passed
Pull Request — master (#50)
by Ronan
04:19
created

UserLevel   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 0
f 0
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 10 1
1
<?php
2
declare(strict_types=1);
3
4
use App\Model\User;
5
use Phinx\Migration\AbstractMigration;
6
7
final class UserLevel extends AbstractMigration
8
{
9
    /**
10
     * Change Method.
11
     *
12
     * Write your reversible migrations using this method.
13
     *
14
     * More information on writing migrations is available here:
15
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
16
     *
17
     * Remember to call "create()" or "update()" and NOT "save()" when working
18
     * with the Table class.
19
     */
20
    public function change(): void
21
    {
22
        $users = $this->table(User::table());
23
        $users
24
            ->addColumn('user_level', 'string', [
25
                'length' => 16,
26
                'null'   => false,
27
                'after'  => 'user_preferences',
28
            ])
29
            ->update();
30
    }
31
}
32