-- =========================================================
-- MIGRATION: Update users table for multi-step registration
-- Run this ONLY if you already imported the old schema.sql
-- (the one that had a single `full_name` column).
--
-- If you have NOT imported anything yet, skip this file —
-- just import the updated schema_cpanel.sql instead.
-- =========================================================

ALTER TABLE users
    ADD COLUMN first_name   VARCHAR(60)  NOT NULL AFTER id,
    ADD COLUMN last_name    VARCHAR(60)  NOT NULL AFTER first_name,
    ADD COLUMN phone_number VARCHAR(20)  NOT NULL AFTER last_name;

-- If you had existing test rows with full_name, split them manually,
-- then drop the old column:
-- ALTER TABLE users DROP COLUMN full_name;

ALTER TABLE users
    ADD UNIQUE KEY uniq_phone (phone_number),
    ADD INDEX idx_users_phone (phone_number);
