-- Migration: Add phone column to all invoice tables
-- Allows direct phone lookup instead of S2S resolve_user
-- Run: mysql -u root WalletIntaleqDB < migration_add_phone.sql

ALTER TABLE invoices_shamcash
  ADD COLUMN phone VARCHAR(20) AFTER driverID,
  ADD INDEX idx_phone_status (phone, status);

ALTER TABLE invoices_shamcash_passenger
  ADD COLUMN phone VARCHAR(20) AFTER passengerID,
  ADD INDEX idx_phone_status (phone, status);

ALTER TABLE cliq_invoices
  ADD COLUMN phone VARCHAR(20) AFTER user_type,
  ADD INDEX idx_phone_status (phone, status);

ALTER TABLE invoices_sms
  ADD COLUMN phone VARCHAR(20) AFTER driverID,
  ADD INDEX idx_phone_status (phone, status);

ALTER TABLE invoices_sms_passenger
  ADD COLUMN phone VARCHAR(20) AFTER passengerID,
  ADD INDEX idx_phone_status (phone, status);

ALTER TABLE mtn_invoices
  ADD COLUMN phone VARCHAR(20) AFTER user_type,
  ADD INDEX idx_phone_status (phone, status);
