-- Store crypto API payment_id from POST api/v1/withdrawal response (result.payment.payment_id).
ALTER TABLE payouts
  ADD COLUMN payment_id INT NULL COMMENT 'Crypto API payment id from withdrawal response' AFTER amount_to_send;

-- Extend payout status with WAITING.
ALTER TABLE payouts
  MODIFY COLUMN status VARCHAR(20) NOT NULL DEFAULT 'PROCESSING' COMMENT 'PROCESSING, COMPLETED, CANCELLED, WAITING';

-- Add updated_at; initially equal to created_at.
ALTER TABLE payouts
  ADD COLUMN updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER created_at;
UPDATE payouts SET updated_at = created_at;
