<?php

use yii\db\Migration;
use yii\db\Schema;

/**
 * Handles the creation of table `{{%master}}`.
 */
class m181105_151442_create_master_table extends Migration
{
    public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';

    /**
     * @inheritdoc
     */
    public function up()
    {
        /**
         * 大师
         */
        $this->createTable('{{%master}}', [
            'id' => Schema::TYPE_PK,
            'name' => Schema::TYPE_STRING . "(20) NOT NULL  COMMENT '名称'",
            'desc' => Schema::TYPE_STRING . "(300) NOT NULL  COMMENT '简介'",
            'province' => Schema::TYPE_STRING . "(50) NOT NULL  COMMENT '省份'",
            'city' => Schema::TYPE_STRING . "(50) NOT NULL  COMMENT '城市'",
            'area' => Schema::TYPE_STRING . "(50) NOT NULL  COMMENT '区域'",
            'address' => Schema::TYPE_STRING . "(200) NOT NULL  COMMENT '详细地址'",
            'fields' => Schema::TYPE_STRING . "(20) NOT NULL  COMMENT '领域'",
            'works' => Schema::TYPE_STRING . "(200) NOT NULL  COMMENT '代表作'",
            'tel' => Schema::TYPE_STRING . "(11) NOT NULL  COMMENT '联系电话'",
            'vid' => Schema::TYPE_STRING . "(32) NOT NULL  COMMENT '腾讯视频vid'",
            'created_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
            'updated_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
            'status' => Schema::TYPE_SMALLINT . "(1) NOT NULL DEFAULT '1' COMMENT '状态'",
        ], $this->tableOptions);

    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('{{%master}}');
    }
}
