Deployments   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 35
c 0
b 0
f 0
dl 0
loc 73
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 46 1
1
<?php
2
3
4
use Phinx\Migration\AbstractMigration;
5
6
class Deployments extends AbstractMigration
7
{
8
    /**
9
     * Change Method.
10
     *
11
     * Write your reversible migrations using this method.
12
     *
13
     * More information on writing migrations is available here:
14
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
15
     *
16
     * The following commands can be used in this method and Phinx will
17
     * automatically reverse them when rolling back:
18
     *
19
     *    createTable
20
     *    renameTable
21
     *    addColumn
22
     *    addCustomColumn
23
     *    renameColumn
24
     *    addIndex
25
     *    addForeignKey
26
     *
27
     * Any other destructive changes will result in an error when trying to
28
     * rollback the migration.
29
     *
30
     * Remember to call "create()" or "update()" and NOT "save()" when working
31
     * with the Table class.
32
     */
33
    public function change()
34
    {
35
        $deployments = $this->table('deployments', [
36
            'id' => 'deployment_id',
37
        ]);
38
        $deployments
39
            ->addColumn('deployment_project', 'integer')
40
            ->addColumn('deployment_number', 'integer', [
41
                'default' => 0,
42
                'null' => false
43
            ])
44
            ->addColumn('deployment_sha', 'string', [
45
                'length' => 64,
46
                'null' => false
47
            ])
48
            ->addColumn('deployment_author', 'string', [
49
                'length' => 1024,
50
                'null' => false
51
            ])
52
            ->addColumn('deployment_message', 'string', [
53
                'length' => 1024,
54
                'null' => false
55
            ])
56
            ->addColumn('deployment_configuration', 'string', [
57
                'length' => 4096,
58
                'null' => false
59
            ])
60
            ->addColumn('deployment_status', 'string', [
61
                'length' => 20,
62
                'null' => false
63
            ])
64
            ->addColumn('deployment_started', 'datetime', [
65
                'null' => true,
66
                'default' => null
67
            ])
68
            ->addColumn('deployment_finished', 'datetime', [
69
                'null' => true,
70
                'default' => null
71
            ])
72
            ->addColumn('deployment_failed', 'datetime', [
73
                'null' => true,
74
                'default' => null
75
            ])
76
            ->addTimestamps('deployment_created', 'deployment_updated')
77
            ->addIndex(['deployment_project'])
78
            ->create();
79
    }
80
}
81