暂存一下,防止丢失
This commit is contained in:
20
migrations/000177_add_agent_wallet_refund_unique.down.sql
Normal file
20
migrations/000177_add_agent_wallet_refund_unique.down.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
BEGIN;
|
||||
|
||||
-- 停止退款生产者后在同一事务锁定资金流水与 Outbox,避免检查和删索引之间提交新事实。
|
||||
LOCK TABLE tb_agent_wallet_transaction, tb_outbox_event IN ACCESS EXCLUSIVE MODE;
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1
|
||||
FROM tb_outbox_event
|
||||
WHERE event_type = 'wallet.agent_main.refunded'
|
||||
) THEN
|
||||
RAISE EXCEPTION '已存在代理主钱包统一退款事实,禁止移除退款防重约束';
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
|
||||
DROP INDEX IF EXISTS uq_agent_wallet_refund_reference;
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user