Completed
Push — master ( c75724...87d358 )
by Razon
03:04
created

m190829_053119_table_article_like::safeUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
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 m190829_053119_table_article_like
6
 */
7
class m190829_053119_table_article_like extends Migration
8
{
9
    private $tableName = '{{%article_like}}';
10
11
    public function safeUp()
12
    {
13
        $this->createTable($this->tableName, [
14
            'article_id' => $this->integer()->notNull()->comment('Article ID'),
15
            'user_id' => $this->integer()->notNull()->comment('User ID'),
16
            'create_time' => $this->createTimestamp(),
17
        ], $this->tableOptions());
18
19
        $this->addPrimaryKey('article_like_pk', $this->tableName, ['article_id', 'user_id']);
20
    }
21
22
    public function safeDown()
23
    {
24
        $this->dropTable($this->tableName);
25
    }
26
}
27