-- Performance optimization indexes for fast profile lookups, aliases, unlocks, and leaderboard.

CREATE INDEX IF NOT EXISTS idx_profiles_username_lower ON profiles (lower(username));
CREATE INDEX IF NOT EXISTS idx_profiles_alias_lower ON profiles (lower(alias));
CREATE INDEX IF NOT EXISTS idx_profiles_discord_id ON profiles (discord_id);
CREATE INDEX IF NOT EXISTS idx_profiles_views ON profiles (views DESC NULLS LAST);
CREATE INDEX IF NOT EXISTS idx_user_unlocks_user_item ON user_unlocks (user_id, item_type);
CREATE INDEX IF NOT EXISTS idx_profiles_public_uid ON profiles (public_uid);
