-- FINAL FIX: Remove UNIQUE constraint from referralCode in referrals table
-- The unique index name is 'referralCode_3' (from your error message)

-- Step 1: Drop the unique index
ALTER TABLE `referrals` DROP INDEX `referralCode_3`;

-- Step 2: Create a non-unique index for performance
CREATE INDEX `idx_referral_code` ON `referrals`(`referralCode`);

-- Step 3: Verify it worked (should show NON_UNIQUE = 1)
SHOW INDEX FROM `referrals` WHERE Column_name = 'referralCode';

-- After running this, you can insert multiple rows with the same referralCode!

