H-60: harden Captain migration rollback and concurrency (#10)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-13 17:13:17 +08:00
committed by GitHub
co-authored by rogee
parent 0540ae3791
commit fcfe5bd37c
4 changed files with 153 additions and 9 deletions
@@ -1,4 +1,7 @@
DROP INDEX IF EXISTS idx_captain_inboxes_active_inbox;
DROP INDEX IF EXISTS idx_agent_bot_inboxes_bot_inbox;
DROP INDEX IF EXISTS idx_agent_bots_captain_assistant;
ALTER TABLE agent_bots DROP COLUMN IF EXISTS captain_assistant_id;
-- The up migration merges duplicate bots/bindings and rewrites references.
-- Those deleted rows and original references cannot be reconstructed safely.
DO $$
BEGIN
RAISE EXCEPTION 'migration 000079 is irreversible: restore from backup instead of migrating down';
END
$$;