From dd420a1684bbcaa39cae7fcb260354d59987bdfa Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 13:10:43 +0000 Subject: [PATCH] Fix: Add missing ride fields to database --- src/integrations/supabase/types.ts | 87 +++++++++++++++++++ src/lib/entityTransformers.ts | 34 ++++++++ src/pages/RideDetail.tsx | 6 +- src/types/database.ts | 6 +- ...3_1a52cd06-7862-41f8-aa08-444989485243.sql | 83 ++++++++++++++++++ 5 files changed, 210 insertions(+), 6 deletions(-) create mode 100644 supabase/migrations/20251030130843_1a52cd06-7862-41f8-aa08-444989485243.sql diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 262456c5..ce0aae71 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -3510,13 +3510,17 @@ export type Database = { rides: { Row: { age_requirement: number | null + animatronics_count: number | null + arm_length_meters: number | null average_rating: number | null banner_image_id: string | null banner_image_url: string | null + boat_capacity: number | null capacity_per_hour: number | null card_image_id: string | null card_image_url: string | null category: string + character_theme: string | null closing_date: string | null closing_date_precision: string | null coaster_type: string | null @@ -3525,6 +3529,8 @@ export type Database = { designer_id: string | null drop_height_meters: number | null duration_seconds: number | null + educational_theme: string | null + flume_type: string | null height_requirement: number | null id: string image_url: string | null @@ -3532,36 +3538,63 @@ export type Database = { inversions: number | null length_meters: number | null manufacturer_id: string | null + max_age: number | null max_g_force: number | null max_height_meters: number | null + max_height_reached_meters: number | null max_speed_kmh: number | null + min_age: number | null + motion_pattern: string | null name: string opening_date: string | null opening_date_precision: string | null park_id: string + platform_count: number | null + projection_type: string | null propulsion_method: string[] | null review_count: number | null ride_model_id: string | null ride_sub_type: string | null + ride_system: string | null + rotation_speed_rpm: number | null + rotation_type: string | null + round_trip_duration_seconds: number | null + route_length_meters: number | null + scenes_count: number | null seating_type: string | null + show_duration_seconds: number | null slug: string + splash_height_meters: number | null + stations_count: number | null status: string + story_description: string | null support_material: string[] | null + swing_angle_degrees: number | null + theme_name: string | null track_material: string[] | null + transport_type: string | null updated_at: string + vehicle_capacity: number | null + vehicles_count: number | null view_count_30d: number | null view_count_7d: number | null view_count_all: number | null + water_depth_cm: number | null + wetness_level: string | null } Insert: { age_requirement?: number | null + animatronics_count?: number | null + arm_length_meters?: number | null average_rating?: number | null banner_image_id?: string | null banner_image_url?: string | null + boat_capacity?: number | null capacity_per_hour?: number | null card_image_id?: string | null card_image_url?: string | null category: string + character_theme?: string | null closing_date?: string | null closing_date_precision?: string | null coaster_type?: string | null @@ -3570,6 +3603,8 @@ export type Database = { designer_id?: string | null drop_height_meters?: number | null duration_seconds?: number | null + educational_theme?: string | null + flume_type?: string | null height_requirement?: number | null id?: string image_url?: string | null @@ -3577,36 +3612,63 @@ export type Database = { inversions?: number | null length_meters?: number | null manufacturer_id?: string | null + max_age?: number | null max_g_force?: number | null max_height_meters?: number | null + max_height_reached_meters?: number | null max_speed_kmh?: number | null + min_age?: number | null + motion_pattern?: string | null name: string opening_date?: string | null opening_date_precision?: string | null park_id: string + platform_count?: number | null + projection_type?: string | null propulsion_method?: string[] | null review_count?: number | null ride_model_id?: string | null ride_sub_type?: string | null + ride_system?: string | null + rotation_speed_rpm?: number | null + rotation_type?: string | null + round_trip_duration_seconds?: number | null + route_length_meters?: number | null + scenes_count?: number | null seating_type?: string | null + show_duration_seconds?: number | null slug: string + splash_height_meters?: number | null + stations_count?: number | null status?: string + story_description?: string | null support_material?: string[] | null + swing_angle_degrees?: number | null + theme_name?: string | null track_material?: string[] | null + transport_type?: string | null updated_at?: string + vehicle_capacity?: number | null + vehicles_count?: number | null view_count_30d?: number | null view_count_7d?: number | null view_count_all?: number | null + water_depth_cm?: number | null + wetness_level?: string | null } Update: { age_requirement?: number | null + animatronics_count?: number | null + arm_length_meters?: number | null average_rating?: number | null banner_image_id?: string | null banner_image_url?: string | null + boat_capacity?: number | null capacity_per_hour?: number | null card_image_id?: string | null card_image_url?: string | null category?: string + character_theme?: string | null closing_date?: string | null closing_date_precision?: string | null coaster_type?: string | null @@ -3615,6 +3677,8 @@ export type Database = { designer_id?: string | null drop_height_meters?: number | null duration_seconds?: number | null + educational_theme?: string | null + flume_type?: string | null height_requirement?: number | null id?: string image_url?: string | null @@ -3622,26 +3686,49 @@ export type Database = { inversions?: number | null length_meters?: number | null manufacturer_id?: string | null + max_age?: number | null max_g_force?: number | null max_height_meters?: number | null + max_height_reached_meters?: number | null max_speed_kmh?: number | null + min_age?: number | null + motion_pattern?: string | null name?: string opening_date?: string | null opening_date_precision?: string | null park_id?: string + platform_count?: number | null + projection_type?: string | null propulsion_method?: string[] | null review_count?: number | null ride_model_id?: string | null ride_sub_type?: string | null + ride_system?: string | null + rotation_speed_rpm?: number | null + rotation_type?: string | null + round_trip_duration_seconds?: number | null + route_length_meters?: number | null + scenes_count?: number | null seating_type?: string | null + show_duration_seconds?: number | null slug?: string + splash_height_meters?: number | null + stations_count?: number | null status?: string + story_description?: string | null support_material?: string[] | null + swing_angle_degrees?: number | null + theme_name?: string | null track_material?: string[] | null + transport_type?: string | null updated_at?: string + vehicle_capacity?: number | null + vehicles_count?: number | null view_count_30d?: number | null view_count_7d?: number | null view_count_all?: number | null + water_depth_cm?: number | null + wetness_level?: string | null } Relationships: [ { diff --git a/src/lib/entityTransformers.ts b/src/lib/entityTransformers.ts index d87bcf06..e4de7e8e 100644 --- a/src/lib/entityTransformers.ts +++ b/src/lib/entityTransformers.ts @@ -79,6 +79,40 @@ export function transformRideData(submissionData: RideSubmissionData): RideInser track_material: submissionData.track_material || null, support_material: submissionData.support_material || null, propulsion_method: submissionData.propulsion_method || null, + // Water ride specific fields + water_depth_cm: submissionData.water_depth_cm || null, + splash_height_meters: submissionData.splash_height_meters || null, + wetness_level: submissionData.wetness_level || null, + flume_type: submissionData.flume_type || null, + boat_capacity: submissionData.boat_capacity || null, + // Dark ride specific fields + theme_name: submissionData.theme_name || null, + story_description: submissionData.story_description || null, + show_duration_seconds: submissionData.show_duration_seconds || null, + animatronics_count: submissionData.animatronics_count || null, + projection_type: submissionData.projection_type || null, + ride_system: submissionData.ride_system || null, + scenes_count: submissionData.scenes_count || null, + // Flat ride specific fields + rotation_type: submissionData.rotation_type || null, + motion_pattern: submissionData.motion_pattern || null, + platform_count: submissionData.platform_count || null, + swing_angle_degrees: submissionData.swing_angle_degrees || null, + rotation_speed_rpm: submissionData.rotation_speed_rpm || null, + arm_length_meters: submissionData.arm_length_meters || null, + max_height_reached_meters: submissionData.max_height_reached_meters || null, + // Kiddie ride specific fields + min_age: submissionData.min_age || null, + max_age: submissionData.max_age || null, + educational_theme: submissionData.educational_theme || null, + character_theme: submissionData.character_theme || null, + // Transportation ride specific fields + transport_type: submissionData.transport_type || null, + route_length_meters: submissionData.route_length_meters || null, + stations_count: submissionData.stations_count || null, + vehicle_capacity: submissionData.vehicle_capacity || null, + vehicles_count: submissionData.vehicles_count || null, + round_trip_duration_seconds: submissionData.round_trip_duration_seconds || null, banner_image_url: submissionData.banner_image_url || null, banner_image_id: submissionData.banner_image_id || null, card_image_url: submissionData.card_image_url || null, diff --git a/src/pages/RideDetail.tsx b/src/pages/RideDetail.tsx index da911c5a..6f9489c6 100644 --- a/src/pages/RideDetail.tsx +++ b/src/pages/RideDetail.tsx @@ -1123,7 +1123,7 @@ export default function RideDetail() { // Water ride fields water_depth_cm: ride.water_depth_cm, splash_height_meters: ride.splash_height_meters, - wetness_level: ride.wetness_level, + wetness_level: ride.wetness_level as any, flume_type: ride.flume_type, boat_capacity: ride.boat_capacity, // Dark ride fields @@ -1135,7 +1135,7 @@ export default function RideDetail() { ride_system: ride.ride_system, scenes_count: ride.scenes_count, // Flat ride fields - rotation_type: ride.rotation_type, + rotation_type: ride.rotation_type as any, motion_pattern: ride.motion_pattern, platform_count: ride.platform_count, swing_angle_degrees: ride.swing_angle_degrees, @@ -1148,7 +1148,7 @@ export default function RideDetail() { educational_theme: ride.educational_theme, character_theme: ride.character_theme, // Transportation fields - transport_type: ride.transport_type, + transport_type: ride.transport_type as any, route_length_meters: ride.route_length_meters, stations_count: ride.stations_count, vehicle_capacity: ride.vehicle_capacity, diff --git a/src/types/database.ts b/src/types/database.ts index fb69daca..a0a49ef8 100644 --- a/src/types/database.ts +++ b/src/types/database.ts @@ -174,7 +174,7 @@ export interface Ride { // Water ride specific fields water_depth_cm?: number; splash_height_meters?: number; - wetness_level?: 'dry' | 'light' | 'moderate' | 'soaked'; + wetness_level?: string; flume_type?: string; boat_capacity?: number; // Dark ride specific fields @@ -186,7 +186,7 @@ export interface Ride { ride_system?: string; scenes_count?: number; // Flat ride specific fields - rotation_type?: 'horizontal' | 'vertical' | 'multi_axis' | 'pendulum' | 'none'; + rotation_type?: string; motion_pattern?: string; platform_count?: number; swing_angle_degrees?: number; @@ -199,7 +199,7 @@ export interface Ride { educational_theme?: string; character_theme?: string; // Transportation specific fields - transport_type?: 'monorail' | 'train' | 'skylift' | 'ferry' | 'cable_car' | 'peoplemover'; + transport_type?: string; route_length_meters?: number; stations_count?: number; vehicle_capacity?: number; diff --git a/supabase/migrations/20251030130843_1a52cd06-7862-41f8-aa08-444989485243.sql b/supabase/migrations/20251030130843_1a52cd06-7862-41f8-aa08-444989485243.sql new file mode 100644 index 00000000..a1a463d3 --- /dev/null +++ b/supabase/migrations/20251030130843_1a52cd06-7862-41f8-aa08-444989485243.sql @@ -0,0 +1,83 @@ +-- Add category-specific fields to rides table + +-- Water ride specific columns +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS water_depth_cm INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS splash_height_meters DECIMAL(10,2); +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS wetness_level TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS flume_type TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS boat_capacity INTEGER; + +-- Dark ride specific columns +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS theme_name TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS story_description TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS show_duration_seconds INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS animatronics_count INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS projection_type TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS ride_system TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS scenes_count INTEGER; + +-- Flat ride specific columns +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS rotation_type TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS motion_pattern TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS platform_count INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS swing_angle_degrees INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS rotation_speed_rpm INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS arm_length_meters DECIMAL(10,2); +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS max_height_reached_meters DECIMAL(10,2); + +-- Kiddie ride specific columns +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS min_age INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS max_age INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS educational_theme TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS character_theme TEXT; + +-- Transportation ride specific columns +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS transport_type TEXT; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS route_length_meters DECIMAL(10,2); +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS stations_count INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS vehicle_capacity INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS vehicles_count INTEGER; +ALTER TABLE public.rides ADD COLUMN IF NOT EXISTS round_trip_duration_seconds INTEGER; + +-- Add check constraints for enum-like fields +ALTER TABLE public.rides DROP CONSTRAINT IF EXISTS check_wetness_level; +ALTER TABLE public.rides ADD CONSTRAINT check_wetness_level + CHECK (wetness_level IS NULL OR wetness_level IN ('none', 'light', 'moderate', 'heavy', 'soaked')); + +ALTER TABLE public.rides DROP CONSTRAINT IF EXISTS check_flume_type; +ALTER TABLE public.rides ADD CONSTRAINT check_flume_type + CHECK (flume_type IS NULL OR flume_type IN ('log_flume', 'shoot_the_chute', 'river_rapids', 'water_coaster', 'flume_ride')); + +ALTER TABLE public.rides DROP CONSTRAINT IF EXISTS check_projection_type; +ALTER TABLE public.rides ADD CONSTRAINT check_projection_type + CHECK (projection_type IS NULL OR projection_type IN ('2d', '3d', '4d', 'holographic', 'projection_mapping', 'none')); + +ALTER TABLE public.rides DROP CONSTRAINT IF EXISTS check_ride_system; +ALTER TABLE public.rides ADD CONSTRAINT check_ride_system + CHECK (ride_system IS NULL OR ride_system IN ('omnimover', 'trackless', 'motion_simulator', 'boat', 'suspended', 'walk_through')); + +ALTER TABLE public.rides DROP CONSTRAINT IF EXISTS check_rotation_type; +ALTER TABLE public.rides ADD CONSTRAINT check_rotation_type + CHECK (rotation_type IS NULL OR rotation_type IN ('horizontal', 'vertical', 'diagonal', 'multi_axis', 'none')); + +ALTER TABLE public.rides DROP CONSTRAINT IF EXISTS check_motion_pattern; +ALTER TABLE public.rides ADD CONSTRAINT check_motion_pattern + CHECK (motion_pattern IS NULL OR motion_pattern IN ('circular', 'pendulum', 'spinning', 'tilting', 'rocking', 'wave', 'bouncing')); + +ALTER TABLE public.rides DROP CONSTRAINT IF EXISTS check_transport_type; +ALTER TABLE public.rides ADD CONSTRAINT check_transport_type + CHECK (transport_type IS NULL OR transport_type IN ('monorail', 'train', 'chairlift', 'gondola', 'tram', 'peoplemover', 'cable_car')); + +-- Add indexes for commonly queried fields +CREATE INDEX IF NOT EXISTS idx_rides_wetness_level ON public.rides(wetness_level) WHERE wetness_level IS NOT NULL; +CREATE INDEX IF NOT EXISTS idx_rides_transport_type ON public.rides(transport_type) WHERE transport_type IS NOT NULL; +CREATE INDEX IF NOT EXISTS idx_rides_rotation_type ON public.rides(rotation_type) WHERE rotation_type IS NOT NULL; + +-- Add comments for documentation +COMMENT ON COLUMN public.rides.water_depth_cm IS 'Water depth in centimeters for water rides'; +COMMENT ON COLUMN public.rides.splash_height_meters IS 'Maximum splash height in meters'; +COMMENT ON COLUMN public.rides.wetness_level IS 'How wet riders get: none, light, moderate, heavy, soaked'; +COMMENT ON COLUMN public.rides.theme_name IS 'Theme name for dark rides'; +COMMENT ON COLUMN public.rides.story_description IS 'Story/narrative description for dark rides'; +COMMENT ON COLUMN public.rides.rotation_type IS 'Type of rotation for flat rides'; +COMMENT ON COLUMN public.rides.transport_type IS 'Type of transportation system'; \ No newline at end of file