-- +goose Up

ALTER TABLE admin_pickups
  ADD COLUMN settlement_mode VARCHAR(32) NOT NULL DEFAULT 'owner_wallet' COMMENT '结算模式快照: owner_wallet号主钱包/platform_managed平台线下结算' AFTER source_channel,
  ADD COLUMN offline_settlement_status VARCHAR(16) NOT NULL DEFAULT 'none' COMMENT '线下结算状态: none无/pending待线下结算/settled已线下结算' AFTER status,
  ADD COLUMN offline_settlement_remark VARCHAR(255) NOT NULL DEFAULT '' COMMENT '线下结算备注' AFTER offline_settlement_status,
  ADD COLUMN offline_settled_by BIGINT UNSIGNED NULL COMMENT '确认线下结算的管理员ID' AFTER offline_settlement_remark,
  ADD COLUMN offline_settled_at DATETIME NULL COMMENT '线下结算确认时间' AFTER offline_settled_by,
  ADD KEY idx_admin_pickups_offline_settlement (settlement_mode, offline_settlement_status, offline_settled_at);

-- 历史提号已按钱包路径结算，保留默认 owner_wallet/none，避免迁移后产生重复线下付款。

-- +goose Down

ALTER TABLE admin_pickups
  DROP KEY idx_admin_pickups_offline_settlement,
  DROP COLUMN offline_settled_at,
  DROP COLUMN offline_settled_by,
  DROP COLUMN offline_settlement_remark,
  DROP COLUMN offline_settlement_status,
  DROP COLUMN settlement_mode;
