-- Add referral columns to users table
-- This is a simpler version that can be run directly

-- Add referralCode column (skip if already exists)
ALTER TABLE `users` 
ADD COLUMN IF NOT EXISTS `referralCode` VARCHAR(50) NULL UNIQUE AFTER `contactNumber`;

-- Add index for referralCode (skip if already exists)
CREATE INDEX IF NOT EXISTS `idx_referral_code` ON `users`(`referralCode`);

-- Add referredByCode column (skip if already exists)
ALTER TABLE `users` 
ADD COLUMN IF NOT EXISTS `referredByCode` VARCHAR(50) NULL AFTER `referralCode`;

-- Add index for referredByCode (skip if already exists)
CREATE INDEX IF NOT EXISTS `idx_referred_by_code` ON `users`(`referredByCode`);

