Completed
Branch master (4042af)
by Aleksandar
02:32
created

Category   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2
1
<?php
2
3
use MysqlUuid\Formats\Binary;
4
use Phinx\Migration\AbstractMigration;
5
6
class Category extends AbstractMigration
7
{
8
    public function up()
9
    {
10
        $this->table('category', ['id' => false, 'primary_key' => 'category_uuid'])
11
            ->addColumn('category_uuid', 'binary', ['limit' => 16])
12
            ->addColumn('category_id', 'text')
13
            ->addColumn('name', 'text')
14
            ->addColumn('slug', 'text')
15
            ->addColumn('type', 'integer')  // see Article\Entity\ArticleType
16
            ->addColumn('title', 'text', ['null' => true])
17
            ->addColumn('description', 'text', ['null' => true])
18
            ->addColumn('main_img', 'text', ['null' => true])
19
            ->addColumn('is_in_homepage', 'boolean', ['default' => false])
20
            ->addColumn('is_in_category_list', 'boolean', ['default' => true])
21
            ->create();
22
    }
23
24
    public function down()
25
    {
26
        $this->dropTable('category');
27
    }
28
}
29