<?php

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

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

    /**
     * @inheritdoc
     */
    public function up()
    {
        /**
         * 空间
         */
        $this->createTable('{{%space}}', [
            '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 '详细地址'",
            'contacts' => Schema::TYPE_STRING . "(20) 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('{{%space}}');
    }
}
