-- Simple migration to add referral columns to users table
-- Run this if you get "Unknown column 'referralCode'" error

-- Add referralCode column
ALTER TABLE `users` 
ADD COLUMN `referralCode` VARCHAR(50) NULL AFTER `contactNumber`;

-- Add unique index for referralCode
ALTER TABLE `users` 
ADD UNIQUE INDEX `idx_referral_code` (`referralCode`);

-- Add referredByCode column
ALTER TABLE `users` 
ADD COLUMN `referredByCode` VARCHAR(50) NULL AFTER `referralCode`;

-- Add index for referredByCode
ALTER TABLE `users` 
ADD INDEX `idx_referred_by_code` (`referredByCode`);

