Completed
Push — master ( d89e8d...a4e309 )
by Vladimir
04:11
created

NewMapOptionsIssue156   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B change() 0 28 1
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
/**
6
 * @link https://github.com/allejo/bzion/issues/156
7
 */
8
class NewMapOptionsIssue156 extends AbstractMigration
9
{
10
    public function change()
11
    {
12
        $mapsTable = $this->table('maps');
13
        $mapsTable
14
            ->addColumn('world_size', 'integer', [
15
                'after' => 'description',
16
                'signed' => false,
17
                'limit' => 5,
18
                'null' => true,
19
                'comment' => 'The world size of the map',
20
            ])
21
            ->addColumn('randomly_generated', 'boolean', [
22
                'after' => 'world_size',
23
                'null' => false,
24
                'default' => false,
25
                'comment' => 'Whether or not the map is randomly generated each map',
26
            ])
27
            ->addColumn('game_mode', 'integer', [
28
                'after' => 'jumping',
29
                'signed' => false,
30
                'limit' => 2,
31
                'null' => false,
32
                'default' => 1,
33
                'comment' => 'The game mode this map follows', // see GAME_MODE_* consts in Map model
34
            ])
35
            ->update()
36
        ;
37
    }
38
}
39