Files
junhong_cmp_fiber/migrations/000202_add_integration_investigation_indexes.up.sql
break b3499adfca 固化七月迭代审计治理进展以隔离线上热修
Constraint: 切换 main 前必须保存当前七月分支全部项目进展,套餐生效提案仅属于 Iteration/7-11。

Rejected: 将七月套餐修复直接移植到 main | 两个分支的可靠投递架构不同。

Confidence: medium

Scope-risk: broad

Directive: 不得将本提交整体 cherry-pick 到 main;main 套餐热修必须基于其纯 Asynq 代码独立实施。

Tested: git diff --check;openspec validate fix-package-activation-starvation --strict。

Not-tested: 按用户要求未运行自动化测试;go build ./... 因当前审计改造中的 Enterprise 模型字面量和 role.recordFailure 参数类型错误未通过。
2026-08-03 09:47:22 +08:00

36 lines
2.0 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 为外部集成调查中心增加受控组合查询索引,不为 JSONB 摘要增加任意搜索能力。
CREATE INDEX idx_integration_log_result_created
ON tb_integration_log (result, created_at DESC, id DESC);
CREATE INDEX idx_integration_log_provider_created
ON tb_integration_log (provider, created_at DESC, id DESC);
CREATE INDEX idx_integration_log_external_created
ON tb_integration_log (external_id, created_at DESC, id DESC)
WHERE external_id IS NOT NULL;
CREATE INDEX idx_integration_log_audit_event_created
ON tb_integration_log (audit_event_id, created_at DESC, id DESC)
WHERE audit_event_id IS NOT NULL;
DROP INDEX idx_integration_log_trigger;
CREATE INDEX idx_integration_log_trigger
ON tb_integration_log (trigger_series, attempt, created_at, id)
WHERE trigger_series IS NOT NULL;
DROP INDEX idx_integration_log_correlation;
CREATE INDEX idx_integration_log_correlation
ON tb_integration_log (correlation_id, created_at DESC, id DESC)
WHERE correlation_id IS NOT NULL;
COMMENT ON TABLE tb_integration_log IS '外部集成调用、回调及未发送尝试记录';
COMMENT ON COLUMN tb_integration_log.id IS '外部集成记录主键ID';
COMMENT ON COLUMN tb_integration_log.result IS '尝试结果pending仅为内部执行态其余为公开终态';
COMMENT ON COLUMN tb_integration_log.provider IS '外部服务提供方稳定编码';
COMMENT ON COLUMN tb_integration_log.external_id IS '外部系统返回的业务或请求标识';
COMMENT ON COLUMN tb_integration_log.audit_event_id IS '关联审计事件ID仅代码显式维护且不建立外键';
COMMENT ON COLUMN tb_integration_log.trigger_series IS '同一次外部操作显式技术尝试序列的稳定标识';
COMMENT ON COLUMN tb_integration_log.attempt IS '同一技术尝试序列内的单调尝试序号';
COMMENT ON COLUMN tb_integration_log.correlation_id IS '跨请求、异步任务与业务后续步骤的关联ID最长100字符';
COMMENT ON COLUMN tb_integration_log.created_at IS '外部集成记录创建时间';