-- Add roller coaster specific columns to the rides table
ALTER TABLE public.rides 
ADD COLUMN coaster_type TEXT CHECK (coaster_type IN ('steel', 'wood', 'hybrid')),
ADD COLUMN seating_type TEXT,
ADD COLUMN intensity_level TEXT CHECK (intensity_level IN ('family', 'thrill', 'extreme')),
ADD COLUMN former_names JSONB DEFAULT '[]'::jsonb,
ADD COLUMN drop_height_meters NUMERIC(6,2),
ADD COLUMN max_g_force NUMERIC(4,2);

-- Add indexes for better query performance on commonly filtered fields
CREATE INDEX idx_rides_coaster_type ON public.rides(coaster_type) WHERE coaster_type IS NOT NULL;
CREATE INDEX idx_rides_seating_type ON public.rides(seating_type) WHERE seating_type IS NOT NULL;
CREATE INDEX idx_rides_intensity_level ON public.rides(intensity_level) WHERE intensity_level IS NOT NULL;

-- Add comments for documentation
COMMENT ON COLUMN public.rides.coaster_type IS 'Type of roller coaster construction: steel, wood, or hybrid';
COMMENT ON COLUMN public.rides.seating_type IS 'How riders are seated: sit_down, stand_up, flying, inverted, etc.';
COMMENT ON COLUMN public.rides.intensity_level IS 'Target audience intensity: family, thrill, or extreme';
COMMENT ON COLUMN public.rides.former_names IS 'Array of previous names this ride has had';
COMMENT ON COLUMN public.rides.drop_height_meters IS 'Maximum drop height in meters';
COMMENT ON COLUMN public.rides.max_g_force IS 'Maximum G-force experienced on the ride';