DeploymentLog::change()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 21
rs 9.7666
cc 1
nc 1
nop 0
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
class DeploymentLog 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
        $projects = $this->table('events', [
35
            'id' => 'event_id',
36
        ]);
37
        $projects
38
            ->addColumn('event_deployment', 'integer')
39
            ->addColumn('event_type', 'string', [
40
                'length' => 20,
41
                'null' => false
42
            ])
43
            ->addColumn('event_header', 'string', [
44
                'length' => 1024,
45
                'null' => false
46
            ])
47
            ->addColumn('event_detail', 'text', [
48
                'null' => true
49
            ])
50
            ->addTimestamps('event_created', 'event_updated')
51
            ->addIndex(['event_deployment'])
52
            ->create();
53
    }
54
}
55