Completed
Push — master ( 0fc6b5...1201b5 )
by Anton
13s
created

Test   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 10 1
1
<?php
2
/**
3
 * @copyright Bluz PHP Team
4
 * @link https://github.com/bluzphp/skeleton
5
 */
6
7
use Phinx\Migration\AbstractMigration;
8
9
/**
10
 * CreateTestTable
11
 */
12
class Test 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...
13
{
14
15
    /**
16
     * Change Method.
17
     *
18
     * Write your reversible migrations using this method.
19
     *
20
     * More information on writing migrations is available here:
21
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
22
     *
23
     * The following commands can be used in this method and Phinx will
24
     * automatically reverse them when rolling back:
25
     *
26
     *    createTable
27
     *    renameTable
28
     *    addColumn
29
     *    renameColumn
30
     *    addIndex
31
     *    addForeignKey
32
     *
33
     * Remember to call "create()" or "update()" and NOT "save()" when working
34
     * with the Table class.
35
     */
36
    public function change()
37
    {
38
        $table = $this->table('test');
39
        $table
40
            ->addColumn('name', 'string', ['length' => 255])
41
            ->addColumn('email', 'string', ['length' => 255, 'null' => true])
42
            ->addColumn('status', 'enum', ['values' => ['active', 'disable', 'delete']])
43
            ->addTimestamps('created', 'updated')
44
            ->create();
45
    }
46
}
47