SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE `reductionservice`.`rd_merchant_pay_order_record`  (
  `id` bigint NOT NULL,
  `project_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目ID',
  `park_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车场ID',
  `park_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车场名称',
  `merchant_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商家编号',
  `biz_type` int NOT NULL COMMENT '业务类型(1-商户充值)',
  `biz_id` bigint NOT NULL COMMENT '业务ID',
  `payment_order_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支付订单id',
  `merchant_order_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户订单id',
  `member_id` bigint NOT NULL COMMENT '移动端会员ID',
  `should_payment` bigint NOT NULL COMMENT '应付金额 单位/分',
  `actual_payment` bigint NOT NULL COMMENT '实际金额 单位/分',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `pay_callback_time` datetime NULL DEFAULT NULL COMMENT '支付回调时间',
  `pay_way_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付方式',
  `payment_status` int NOT NULL DEFAULT 0 COMMENT '支付状态(0-待付费/1-成功/2-失败)',
  `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `extend_json` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '扩展json字段',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `IX_paymentOrderId`(`payment_order_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '减免商户支付订单记录表' ROW_FORMAT = Dynamic;

ALTER TABLE `reductionservice`.`rd_merchant_timing_present_rule` ADD COLUMN `last_send_time` datetime NULL DEFAULT '2000-01-01 00:00:00' COMMENT '最后执行赠送时间；默认为2000-01-01' AFTER `expired_day`;

SET FOREIGN_KEY_CHECKS=1;