m181206_152650_create_compere_table.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. /**
  5. * Handles the creation of table `{{%compere}}`.
  6. */
  7. class m181206_152650_create_compere_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. * 主持人:ID、姓名、头像、地区、头衔、简介、主要节目,、创建时间、更新时间、状态
  17. */
  18. $this->createTable('{{%compere}}', [
  19. 'id' => Schema::TYPE_PK,
  20. 'name' => Schema::TYPE_STRING . "(20) NOT NULL COMMENT '姓名'",
  21. 'desc' => Schema::TYPE_STRING . "(300) NOT NULL COMMENT '简介'",
  22. 'province' => Schema::TYPE_STRING . "(50) NOT NULL COMMENT '省份'",
  23. 'city' => Schema::TYPE_STRING . "(50) NOT NULL COMMENT '城市'",
  24. 'area' => Schema::TYPE_STRING . "(50) NOT NULL COMMENT '区域'",
  25. 'address' => Schema::TYPE_STRING . "(200) NOT NULL COMMENT '详细地址'",
  26. 'title' => Schema::TYPE_STRING . "(20) NOT NULL COMMENT '头衔'",
  27. 'works' => Schema::TYPE_STRING . "(200) NOT NULL COMMENT '主要节目'",
  28. 'tel' => Schema::TYPE_STRING . "(11) NOT NULL COMMENT '联系电话'",
  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('{{%compere}}');
  40. }
  41. }