<?php

use yii\db\Migration;

/**
 * Class m191119_022939_create_table_attribute
 */
class m191119_022939_create_table_attribute extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function up()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="属性表"';
        $this->createTable('atg_attribute', [
            'id' => $this->primaryKey(),
            'name'=>$this->string(50)->notNull()->comment('属性名'),
            'value'=>$this->text()->notNull()->comment('属性值'),
            'type'=>$this->smallInteger(2)->defaultValue(null)->comment('类型'),
            'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'),
            'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
            'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
            'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
        ],$tableOptions);
    }

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