ALTER TABLE qipai_cleaning_settlements
  ADD COLUMN paid_by BIGINT UNSIGNED NULL AFTER confirmed_at,
  ADD COLUMN payout_channel VARCHAR(32) NOT NULL DEFAULT '' AFTER paid_at,
  ADD COLUMN payout_reference VARCHAR(128) NOT NULL DEFAULT '' AFTER payout_channel,
  ADD COLUMN payout_error VARCHAR(512) NOT NULL DEFAULT '' AFTER payout_reference,
  ADD CONSTRAINT fk_qipai_cleaning_settlements_paid_by FOREIGN KEY (paid_by) REFERENCES qipai_users(id),
  ADD KEY idx_qipai_cleaning_settlement_payout (tenant_id, status, paid_at);

INSERT IGNORE INTO qipai_schema_migrations (version, name)
VALUES ('2026062728', 'm08b_cleaning_payouts');
