m230617_045324_member_stat.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use yii\db\Migration;
  3. class m230617_045324_member_stat extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%member_stat}}', [
  11. 'id' => "int(11) NOT NULL AUTO_INCREMENT",
  12. 'merchant_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '商户id'",
  13. 'store_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '店铺id'",
  14. 'member_id' => "int(10) NULL COMMENT '用户id'",
  15. 'member_type' => "tinyint(4) NULL DEFAULT '1' COMMENT '1:会员;2:后台管理员;3:商家管理员'",
  16. 'nice_num' => "int(10) NULL DEFAULT '0' COMMENT '点赞数量'",
  17. 'disagree_num' => "int(10) NULL DEFAULT '0' COMMENT '不赞同数量'",
  18. 'transmit_num' => "int(11) NULL DEFAULT '0' COMMENT '转发数量'",
  19. 'comment_num' => "int(10) NULL DEFAULT '0' COMMENT '评论数量'",
  20. 'collect_num' => "int(10) NULL DEFAULT '0' COMMENT '收藏'",
  21. 'report_num' => "int(10) NULL DEFAULT '0' COMMENT '举报数量'",
  22. 'recommend_num' => "int(10) NULL DEFAULT '0' COMMENT '推荐数量'",
  23. 'follow_num' => "int(10) NULL DEFAULT '0' COMMENT '关注人数'",
  24. 'allowed_num' => "int(10) NULL DEFAULT '0' COMMENT '被关注人数'",
  25. 'view' => "int(10) NULL DEFAULT '0' COMMENT '浏览量'",
  26. 'status' => "tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]'",
  27. 'created_at' => "int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间'",
  28. 'updated_at' => "int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间'",
  29. 'PRIMARY KEY (`id`)'
  30. ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='食谱_作品'");
  31. /* 索引设置 */
  32. $this->createIndex('member_id','{{%member_stat}}','member_id',0);
  33. /* 表数据 */
  34. /* 设置外键约束 */
  35. $this->execute('SET foreign_key_checks = 1;');
  36. }
  37. public function down()
  38. {
  39. $this->execute('SET foreign_key_checks = 0');
  40. /* 删除表 */
  41. $this->dropTable('{{%member_stat}}');
  42. $this->execute('SET foreign_key_checks = 1;');
  43. }
  44. }
粤ICP备19079148号