m220608_083043_addon_tiny_blog_cate.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use yii\db\Migration;
  3. class m220608_083043_addon_tiny_blog_cate extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%addon_tiny_blog_cate}}', [
  11. 'id' => "int(11) NOT NULL AUTO_INCREMENT COMMENT '主键'",
  12. 'merchant_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '商户id'",
  13. 'store_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '店铺id'",
  14. 'title' => "varchar(50) NOT NULL DEFAULT '' COMMENT '标题'",
  15. 'sort' => "int(5) NULL DEFAULT '0' COMMENT '排序'",
  16. 'level' => "tinyint(1) NULL DEFAULT '1' COMMENT '级别'",
  17. 'pid' => "int(50) NULL DEFAULT '0' COMMENT '上级id'",
  18. 'tree' => "varchar(200) NOT NULL DEFAULT '' COMMENT '树'",
  19. 'status' => "tinyint(4) NULL DEFAULT '1' COMMENT '状态'",
  20. 'created_at' => "int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间'",
  21. 'updated_at' => "int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间'",
  22. 'PRIMARY KEY (`id`)'
  23. ], "ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COMMENT='扩展_博客_文章分类表'");
  24. /* 索引设置 */
  25. /* 表数据 */
  26. /* 设置外键约束 */
  27. $this->execute('SET foreign_key_checks = 1;');
  28. }
  29. public function down()
  30. {
  31. $this->execute('SET foreign_key_checks = 0');
  32. /* 删除表 */
  33. $this->dropTable('{{%addon_tiny_blog_cate}}');
  34. $this->execute('SET foreign_key_checks = 1;');
  35. }
  36. }
粤ICP备19079148号