Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Updates/update_cms_301-2017-02-26-15-02-14.php (1 issue)

1
<?php
2
3
use Ffcms\Core\Migrations\MigrationInterface;
4
use Ffcms\Core\Migrations\Migration;
5
6
/**
7
 * Class update_cms_301.
8
 */
9
class update_cms_301 extends Migration implements MigrationInterface
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...
10
{
11
    /**
12
     * Add database changes, provided in time between 3.0.0 and 3.0.1 release is done
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        // use important column for content app
18
        if (!$this->getSchema()->hasColumn('contents', 'important')) {
19
            $this->getSchema()->table('contents', function ($table) {
20
                $table->boolean('important')->default(false);
21
            });
22
        }
23
        // add group display color features
24
        if (!$this->getSchema()->hasColumn('roles', 'color')) {
25
            $this->getSchema()->table('roles', function ($table) {
26
                $table->string('color')->default('#777777');
27
            });
28
        }
29
30
        parent::up();
31
    }
32
33
    /**
34
     * Seed created table via up() method with some data
35
     * @return void
36
     */
37
    public function seed()
38
    {
39
40
    }
41
42
    /**
43
     * Execute actions when migration is down
44
     * @return void
45
     */
46
    public function down()
47
    {
48
        if ($this->getSchema()->hasColumn('contents', 'important')) {
49
            $this->getSchema()->table('contents', function ($table) {
50
                $table->dropColumn('important');
51
            });
52
        }
53
        if ($this->getSchema()->hasColumn('roles', 'color')) {
54
            $this->getSchema()->table('roles', function ($table) {
55
                $table->dropColumn('color');
56
            });
57
        }
58
        parent::down();
59
    }
60
}