m170724_064147_create_rom_release_table::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `rom_release`.
7
 */
8
class m170724_064147_create_rom_release_table extends Migration
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function up()
14
    {
15
        $tableOptions = null;
16
        if ($this->db->driverName === 'mysql') {
17
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
18
        }
19
        $this->createTable('{{%rom_release}}', [
20
            'id' => $this->primaryKey(),
21
            'version' => $this->string()->notNull()->comment('版本号'),
22
            'version_code' => $this->string()->null()->comment('版本代号'),
23
            'is_forced' => $this->boolean()->notNull()->defaultValue(1)->comment('强制更新'),
24
            'url' => $this->string()->notNull()->comment('下载地址'),
25
            'md5' => $this->string()->notNull()->defaultValue('')->comment('MD5'),
26
            'status' => $this->smallInteger(1)->notNull()->defaultValue(0)->comment('状态'),
27
            'description' => $this->string()->notNull()->comment('发布说明'),
28
            'created_at' => $this->integer()->notNull()->comment('创建时间'),
29
            'updated_at' => $this->integer()->notNull()->comment('更新时间'),
30
        ], $tableOptions . ' COMMENT="发布"');
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function down()
37
    {
38
        $this->dropTable('{{%rom_release}}');
39
    }
40
}
41