<?php

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

/**
 * Handles the creation of table `{{%compere}}`.
 */
class m181206_152650_create_compere_table extends Migration
{
    public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
    /**
     * @inheritdoc
     */
    public function up()
    {

        /**
         * 主持人：ID、姓名、头像、地区、头衔、简介、主要节目，、创建时间、更新时间、状态
         */
        $this->createTable('{{%compere}}', [
            '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 '详细地址'",
            'title' => Schema::TYPE_STRING . "(20) NOT NULL  COMMENT '头衔'",
            'works' => Schema::TYPE_STRING . "(200) NOT NULL  COMMENT '主要节目'",
            'tel' => Schema::TYPE_STRING . "(11) NOT NULL  COMMENT '联系电话'",
            '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('{{%compere}}');
    }
}
