-- ============================================================
-- Migration: add Bank Transfer as a payment method
-- Run this ONCE if you already installed the earlier schema.sql
-- (skip this file entirely on a brand-new install — schema.sql
-- already includes everything below).
-- ============================================================

ALTER TABLE orders
  ADD COLUMN payment_method ENUM('binance','bank_transfer') NOT NULL DEFAULT 'binance' AFTER order_type,
  ADD COLUMN bank_txn_reference VARCHAR(150) DEFAULT NULL AFTER checkout_url,
  ADD COLUMN bank_sender_name VARCHAR(150) DEFAULT NULL AFTER bank_txn_reference,
  ADD COLUMN bank_note VARCHAR(500) DEFAULT NULL AFTER bank_sender_name,
  ADD COLUMN bank_proof_submitted_at TIMESTAMP NULL DEFAULT NULL AFTER bank_note;

INSERT INTO settings (setting_key, setting_value) VALUES
 ('bank_name', ''),
 ('bank_account_name', ''),
 ('bank_account_number', ''),
 ('bank_routing_swift', ''),
 ('bank_branch', ''),
 ('bank_instructions', 'Please use your Order Reference as the transfer memo/note so we can match your payment.')
ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value);
