m190822_034841_table_article_category   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 3 1
A safeUp() 0 11 1
1
<?php
2
use App\Db\Migration;
3
4
/**
5
 * Class m190822_034841_table_article_category
6
 */
7
class m190822_034841_table_article_category extends Migration
8
{
9
    private $tableName = '{{%article_category}}';
10
11
    public function safeUp()
12
    {
13
        $this->createTable($this->tableName, [
14
            'id' => $this->primaryKey(),
15
            'creator' => $this->integer()->notNull()->comment('Creator ID'),
16
            'name' => $this->string(32)->notNull()->comment('Name'),
17
            'create_time' => $this->createTimestamp(),
18
            'update_time' => $this->updateTimestamp(),
19
        ], $this->tableOptions());
20
21
        $this->createIndex('article_category_idx_creator', $this->tableName, ['creator']);
22
    }
23
24
    public function safeDown()
25
    {
26
        $this->dropTable($this->tableName);
27
    }
28
}
29