m181105_191112_create_interview_table.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. /**
  5. * Handles the creation of table `{{%interview}}`.
  6. */
  7. class m181105_191112_create_interview_table extends Migration
  8. {
  9. public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
  10. /**
  11. * @inheritdoc
  12. */
  13. public function up()
  14. {
  15. /**
  16. * 大师
  17. */
  18. $this->createTable('{{%interview}}', [
  19. 'id' => Schema::TYPE_PK,
  20. 'compere_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '主持人'",
  21. 'master_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '大师'",
  22. 'title' => Schema::TYPE_STRING . "(20) NOT NULL COMMENT '标题'",
  23. 'desc' => Schema::TYPE_STRING . "(300) NOT NULL COMMENT '开场白'",
  24. 'province' => Schema::TYPE_STRING . "(50) NOT NULL COMMENT '省份'",
  25. 'city' => Schema::TYPE_STRING . "(50) NOT NULL COMMENT '城市'",
  26. 'area' => Schema::TYPE_STRING . "(50) NOT NULL COMMENT '区域'",
  27. 'address' => Schema::TYPE_STRING . "(200) NOT NULL COMMENT '详细地址'",
  28. 'vid' => Schema::TYPE_STRING . "(32) NOT NULL COMMENT '腾讯视频vid'",
  29. 'created_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
  30. 'updated_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
  31. 'status' => Schema::TYPE_SMALLINT . "(1) NOT NULL DEFAULT '1' COMMENT '状态'",
  32. ], $this->tableOptions);
  33. }
  34. /**
  35. * @inheritdoc
  36. */
  37. public function down()
  38. {
  39. $this->dropTable('{{%interview}}');
  40. }
  41. }