UserName   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
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 37
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 10 1
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
class UserName extends AbstractMigration
6
{
7
    /**
8
     * Change Method.
9
     *
10
     * Write your reversible migrations using this method.
11
     *
12
     * More information on writing migrations is available here:
13
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
14
     *
15
     * The following commands can be used in this method and Phinx will
16
     * automatically reverse them when rolling back:
17
     *
18
     *    createTable
19
     *    renameTable
20
     *    addColumn
21
     *    addCustomColumn
22
     *    renameColumn
23
     *    addIndex
24
     *    addForeignKey
25
     *
26
     * Any other destructive changes will result in an error when trying to
27
     * rollback the migration.
28
     *
29
     * Remember to call "create()" or "update()" and NOT "save()" when working
30
     * with the Table class.
31
     */
32
    public function change()
33
    {
34
        $table = $this->table('users');
35
        $table
36
            ->addColumn('user_name', 'string', [
37
                'length' => 1024,
38
                'null'   => false,
39
                'after'  => 'user_id',
40
            ])
41
            ->update();
42
    }
43
}
44