-- Migration 003: Onboarding Flow -- Adds onboarding tracking to users and new onboarding achievements -- Add onboarding columns to users table ALTER TABLE users ADD COLUMN IF NOT EXISTS onboarding_complete BOOLEAN DEFAULT false; ALTER TABLE users ADD COLUMN IF NOT EXISTS onboarding_step INTEGER DEFAULT 0; -- Create index for finding users who haven't completed onboarding CREATE INDEX IF NOT EXISTS idx_users_onboarding ON users(onboarding_complete) WHERE onboarding_complete = false; -- Insert onboarding achievements INSERT INTO achievements (code, name, description, icon, xp_reward, category) VALUES ('welcome_tour', 'Welcome Tour', 'Completed the welcome tutorial', 'πŸŽ‰', 50, 'onboarding'), ('first_arcade_visit', 'Explorer', 'Visited the arcade for the first time', 'πŸ—ΊοΈ', 25, 'onboarding'), ('profile_customized', 'Personal Touch', 'Customized your profile', '✨', 50, 'onboarding'), ('onboarding_complete', 'Ready to Play!', 'Completed all getting started steps', 'πŸš€', 100, 'onboarding') ON CONFLICT (code) DO NOTHING; -- Grant permissions GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO gamearc; GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO gamearc;