-- ============================================================================
-- Kings & Queens Arena — auth/password/mobile migration (run on roscaw_tnet)
-- Adds TZ mobile, terms acceptance, and password-reset code columns.
-- Safe to run on a DB that already has the base COPER schema imported.
-- ============================================================================

SET NAMES utf8mb4;

ALTER TABLE `users`
  ADD COLUMN `mobile` VARCHAR(20) NULL COMMENT 'Tanzanian mobile (+255…) used for deposits/withdrawals' AFTER `password_hash`,
  ADD COLUMN `terms_accepted` TINYINT(1) NOT NULL DEFAULT 0 AFTER `mobile`,
  ADD COLUMN `reset_code_hash` CHAR(64) NULL COMMENT 'SHA-256 of the password-reset code' AFTER `terms_accepted`,
  ADD COLUMN `reset_code_expires` DATETIME NULL AFTER `reset_code_hash`,
  ADD UNIQUE KEY `uq_users_mobile` (`mobile`);