Compare commits

..

2 Commits

Author SHA1 Message Date
shanshanzhong147 fa4ad25422 修复(#79): 合并最新internal迁移
Co-authored-by: multica-agent <github@multica.ai>
2026-05-27 02:01:12 -07:00
shanshanzhong147 c90edac630 修复(#73): 修正促销迁移表结构 — subscribe_promo 加 quantity + 索引优化
Build docker and publish / build (20.15.1) (push) Failing after 8m28s
Build docker and publish / build (20.15.1) (pull_request) Successful in 7m59s
- subscribe_promo 新增 quantity 列,唯一键改为 (subscribe_id, quantity, promo_rule_id)
- promo_rule 索引合并为 idx_enabled_priority_deleted (enabled, deleted_at, priority DESC)

Co-authored-by: multica-agent <github@multica.ai>
2026-05-27 01:10:31 -07:00
@@ -11,14 +11,13 @@ CREATE TABLE IF NOT EXISTS `promo_rule` (
`updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted_at` DATETIME DEFAULT NULL COMMENT '软删除时间', `deleted_at` DATETIME DEFAULT NULL COMMENT '软删除时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_enabled_priority` (`enabled`, `priority` DESC), KEY `idx_enabled_priority_deleted` (`enabled`, `deleted_at`, `priority` DESC)
KEY `idx_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='促销规则表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='促销规则表';
CREATE TABLE IF NOT EXISTS `subscribe_promo` ( CREATE TABLE IF NOT EXISTS `subscribe_promo` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`subscribe_id` BIGINT UNSIGNED NOT NULL COMMENT '套餐规格 ID', `subscribe_id` BIGINT UNSIGNED NOT NULL COMMENT '套餐规格 ID',
`quantity` BIGINT NOT NULL DEFAULT 1 COMMENT '购买数量', `quantity` INT NOT NULL DEFAULT 0 COMMENT '购买数量',
`promo_rule_id` BIGINT UNSIGNED NOT NULL COMMENT '促销规则 ID', `promo_rule_id` BIGINT UNSIGNED NOT NULL COMMENT '促销规则 ID',
`promo_price` BIGINT NOT NULL DEFAULT 0 COMMENT '该规格在此规则下的优惠价(分)', `promo_price` BIGINT NOT NULL DEFAULT 0 COMMENT '该规格在此规则下的优惠价(分)',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,