fix: 锁定日计划后创建调度领取
This commit is contained in:
@@ -102,6 +102,9 @@ CREATE TABLE IF NOT EXISTS `lms_daily_plan_operation_log` (
|
||||
) COMMENT='LMS日计划操作日志';
|
||||
|
||||
-- 兼容已执行过旧版脚本的数据库,幂等补充候选组合索引。
|
||||
SET @lms_claim_progress_upgrade = NOT EXISTS(
|
||||
SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
|
||||
AND table_name = 'lms_daily_plan_claim' AND column_name = 'progress_qty');
|
||||
SET @lms_daily_plan_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'lms_daily_plan' AND index_name = 'idx_stocking_candidate'),
|
||||
@@ -118,6 +121,14 @@ SET @lms_daily_plan_ddl = IF(
|
||||
PREPARE lms_daily_plan_stmt FROM @lms_daily_plan_ddl;
|
||||
EXECUTE lms_daily_plan_stmt;
|
||||
DEALLOCATE PREPARE lms_daily_plan_stmt;
|
||||
-- 旧版活跃 Claim 没有可靠的领取时进度快照,首次升级时统一释放,避免按默认 0 错误确认。
|
||||
SET @lms_daily_plan_ddl = IF(
|
||||
@lms_claim_progress_upgrade,
|
||||
'UPDATE lms_daily_plan_claim SET claim_status = 2, active_flag = NULL, updater = ''SQL_UPGRADE'' WHERE claim_status = 0 AND active_flag = 1 AND deleted = b''0''',
|
||||
'SELECT 1');
|
||||
PREPARE lms_daily_plan_stmt FROM @lms_daily_plan_ddl;
|
||||
EXECUTE lms_daily_plan_stmt;
|
||||
DEALLOCATE PREPARE lms_daily_plan_stmt;
|
||||
SET @lms_daily_plan_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
|
||||
AND table_name = 'lms_daily_plan_claim' AND column_name = 'version'),
|
||||
|
||||
Reference in New Issue
Block a user