m221116_150896_create_qimall_order_unread_msg.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. class m221116_150896_create_qimall_order_unread_msg extends Migration
  5. {
  6. public function safeUp()
  7. {
  8. $table = 'qimall_order_unread_msg';
  9. $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  10. $res = $this->db->createCommand($sql)->execute();
  11. if(!empty($res)) return '';
  12. $this->execute("CREATE TABLE `qimall_order_unread_msg` (
  13. `id` int(11) NOT NULL AUTO_INCREMENT,
  14. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商场ID',
  15. `order_pay_num` int(11) DEFAULT NULL COMMENT '待付款数量',
  16. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  17. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  18. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  19. `order_received_num` int(11) DEFAULT NULL COMMENT '待收货数量',
  20. `order_goods_num` int(11) DEFAULT NULL COMMENT '待发货数量',
  21. `order_evaluate_num` int(11) DEFAULT NULL COMMENT '待评价数量',
  22. `order_return_num` int(11) DEFAULT NULL COMMENT '退货数量',
  23. `user_id` int(11) DEFAULT NULL COMMENT '会员ID',
  24. `is_statistics` int(11) DEFAULT '0' COMMENT '是否已经执行过统计,因为这功能是后面上的,需要执行一次统计数据才会正确',
  25. PRIMARY KEY (`id`) USING BTREE,
  26. KEY `mall_id` (`mall_id`) USING BTREE
  27. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='会员订单未读消息统计'");
  28. }
  29. public function safeDown()
  30. {
  31. $this->dropTable('qimall_order_unread_msg');
  32. }
  33. }