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

NewMapOptionsIssue156::change()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 22
nc 1
nop 0
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