m190822_070400_data_article_category   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 3 1
A safeUp() 0 9 1
1
<?php
2
use App\Db\Migration;
3
4
/**
5
 * Class m190822_070400_data_article_category
6
 */
7
class m190822_070400_data_article_category extends Migration
8
{
9
    private $tableName = '{{%article_category}}';
10
11
    public function safeUp()
12
    {
13
        $columns = ['id', 'name', 'creator', 'create_time', 'update_time'];
14
        $now = time();
15
        $rows = [
16
            [1, 'News', 1, $now, $now],
17
        ];
18
19
        $this->batchInsert($this->tableName, $columns, $rows);
20
    }
21
22
    public function safeDown()
23
    {
24
        $this->truncateTable($this->tableName);
25
    }
26
}
27