<?php

use yii\db\Migration;

/**
 * Class m191112_005702_create_table_comment
 */
class m191112_005702_create_table_comment extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function up()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="评论记录表"';
        $this->createTable('ats_comment', [
            'id' => $this->primaryKey(),
            'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
            'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单详情商品id'),
            'star'=>$this->integer(11)->defaultValue(null)->comment('星级'),
            'content'=>$this->text()->comment('评论内容'),
            'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态:1为显示,0为不显示'),
            'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
            'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
        ],$tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function down()
    {
        $this->dropTable('ats_comment');
        return true;
    }
}