-- 066_worker_unfreeze_fund_type.sql —— 区分待解冻押金与待解冻报酬，防止后台扣押金误扣报酬。

ALTER TABLE worker_deposit_unfreezes
  ADD COLUMN IF NOT EXISTS fund_type TEXT NOT NULL DEFAULT 'legacy_combined';

CREATE INDEX IF NOT EXISTS idx_worker_deposit_unfreezes_order_fund_status
  ON worker_deposit_unfreezes(work_order_id, fund_type, status);

COMMENT ON COLUMN worker_deposit_unfreezes.fund_type IS '待解冻资金类型：deposit 押金 / reward 报酬 / legacy_combined 历史合并记录';
