bookwiz.io / supabase / migrations / 046_add_welcome_tour_tracking.sql
046_add_welcome_tour_tracking.sql
Raw
-- Add welcome tour tracking to profiles table
-- This tracks which users have completed the welcome tour

-- Add welcome_tour_completed column to profiles table
ALTER TABLE profiles 
ADD COLUMN IF NOT EXISTS welcome_tour_completed BOOLEAN DEFAULT false;

-- Add welcome_tour_completed_at column to track when the tour was completed
ALTER TABLE profiles 
ADD COLUMN IF NOT EXISTS welcome_tour_completed_at TIMESTAMP WITH TIME ZONE;

-- Create index for tour completion queries
CREATE INDEX IF NOT EXISTS idx_profiles_welcome_tour_completed 
ON profiles (welcome_tour_completed);

-- Add comment for documentation
COMMENT ON COLUMN profiles.welcome_tour_completed IS 'Whether the user has completed the welcome tour';
COMMENT ON COLUMN profiles.welcome_tour_completed_at IS 'When the user completed the welcome tour';

-- Update RLS policies to allow users to update their own tour status
-- This is already covered by the existing "Users can update their own profile" policy