yeg
2026-09-18 46a87c49f79e09c3b6abd10742de1f4d2a884fb9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- 开发库(局域网共享的 talent_card,MySQL 5.7,Flyway 关闭)手工补齐支付尝试收敛的两列。
--
-- 编号让位(2026-09-17):这两列对应的迁移原为 V149,因与远端已推送的 V149__clear_service_hero_placeholders
-- 撞号,本地让号改为 V152__payment_attempt_convergence.sql;本脚本同步改名。
--
-- 为什么需要这份文件:开发库的结构不由迁移维护,而现有启动初始化器只补商户进件相关的表,
-- 不覆盖 payment_transaction。只写迁移会让开发库缺列,对账任务与支付接口直接以
-- Unknown column 500(见 docs/agents/testing.md 记录的同类事故)。
--
-- 与 V152__payment_attempt_convergence.sql 逐列等价,只是不含存储过程(JDBC 无法直接执行
-- DELIMITER 批处理),所以只能执行一次:重复执行会在「列已存在」上报错,这是安全的失败。
--
-- 执行方式(本机没有 mysql 客户端,用项目已有的 JDBC 驱动):
--   cd talent-card-server
--   .\scripts\apply-sql-file.ps1 -File scripts\dev-schema-v149-payment-attempt.sql
 
alter table payment_transaction
    add column last_reconciled_at datetime default null comment '最近一次对账处理时间(公平轮转与退避依据)';
 
alter table payment_transaction
    add column close_attempts int not null default 0 comment '已发出的关单请求次数(重试上限依据)';
 
create index idx_payment_transaction_reconcile on payment_transaction (status, last_reconciled_at);