M240913015616CreateOrderBehaviorLogsTable.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Handles the creation of table `{{%order_behavior_logs}}`.
  6. */
  7. class M240913015616CreateOrderBehaviorLogsTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_order_behavior_logs` (
  16. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(10) unsigned NOT NULL DEFAULT '0',
  18. `operator_user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作人用户id',
  19. `operator_user_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '操作用户类型 1后台管理员操作 2用户操作 3门店独立后台 4爱优诺 5多商户 6系统自动操作',
  20. `behavior` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '操作行为 1创建订单 2取消订单 3订单支付 4提醒发货 5订单发货 6修改物流 7确认收货 8订单完成 9评价 10申请售后 11删除订单 12备注 13留言 14修改地址 15取消发货 16撤销售后',
  21. `desc` varchar(500) NOT NULL DEFAULT '',
  22. `extra_info` json DEFAULT NULL,
  23. `ip` int(10) unsigned NOT NULL DEFAULT '0',
  24. `status` tinyint(3) unsigned NOT NULL DEFAULT '1',
  25. `operation_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '实际操作时间',
  26. `order_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  27. `created_at` int(10) unsigned NOT NULL DEFAULT '0',
  28. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  29. PRIMARY KEY (`id`),
  30. KEY `operator_search_index` (`mall_id`,`operator_user_type`,`operator_user_id`,`behavior`)
  31. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单行为日志表';
  32. SQL;
  33. $this->execute($sql);
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function safeDown()
  39. {
  40. return false;
  41. }
  42. }