m190822_070400_data_article_category::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
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