Refactor: Remove unused JSON columns

This commit is contained in:
gpt-engineer-app[bot]
2025-10-03 14:12:38 +00:00
parent 0ac87b4dde
commit ee17c2d086
2 changed files with 30 additions and 12 deletions

View File

@@ -1347,7 +1347,6 @@ export type Database = {
name: string
ride_type: string
slug: string
technical_specs: Json | null
updated_at: string
}
Insert: {
@@ -1363,7 +1362,6 @@ export type Database = {
name: string
ride_type: string
slug: string
technical_specs?: Json | null
updated_at?: string
}
Update: {
@@ -1379,7 +1377,6 @@ export type Database = {
name?: string
ride_type?: string
slug?: string
technical_specs?: Json | null
updated_at?: string
}
Relationships: [
@@ -1651,14 +1648,12 @@ export type Database = {
card_image_url: string | null
category: string
closing_date: string | null
coaster_stats: Json | null
coaster_type: string | null
created_at: string
description: string | null
designer_id: string | null
drop_height_meters: number | null
duration_seconds: number | null
former_names: Json | null
height_requirement: number | null
id: string
image_url: string | null
@@ -1678,7 +1673,6 @@ export type Database = {
seating_type: string | null
slug: string
status: string
technical_specs: Json | null
updated_at: string
}
Insert: {
@@ -1691,14 +1685,12 @@ export type Database = {
card_image_url?: string | null
category: string
closing_date?: string | null
coaster_stats?: Json | null
coaster_type?: string | null
created_at?: string
description?: string | null
designer_id?: string | null
drop_height_meters?: number | null
duration_seconds?: number | null
former_names?: Json | null
height_requirement?: number | null
id?: string
image_url?: string | null
@@ -1718,7 +1710,6 @@ export type Database = {
seating_type?: string | null
slug: string
status?: string
technical_specs?: Json | null
updated_at?: string
}
Update: {
@@ -1731,14 +1722,12 @@ export type Database = {
card_image_url?: string | null
category?: string
closing_date?: string | null
coaster_stats?: Json | null
coaster_type?: string | null
created_at?: string
description?: string | null
designer_id?: string | null
drop_height_meters?: number | null
duration_seconds?: number | null
former_names?: Json | null
height_requirement?: number | null
id?: string
image_url?: string | null
@@ -1758,7 +1747,6 @@ export type Database = {
seating_type?: string | null
slug?: string
status?: string
technical_specs?: Json | null
updated_at?: string
}
Relationships: [

View File

@@ -0,0 +1,30 @@
-- ═══════════════════════════════════════════════════════════════════
-- MIGRATION: Remove JSON Columns from Rides and Ride Models
-- ═══════════════════════════════════════════════════════════════════
--
-- This migration enforces the "NEVER STORE JSON IN SQL COLUMNS" rule
-- by removing deprecated JSON columns that have been replaced with
-- proper relational tables:
--
-- rides.former_names → ride_name_history table
-- rides.coaster_stats → ride_coaster_statistics table
-- rides.technical_specs → ride_technical_specifications table
-- ride_models.technical_specs → ride_model_technical_specifications table
--
-- ═══════════════════════════════════════════════════════════════════
-- Drop deprecated JSON columns from rides table
ALTER TABLE rides
DROP COLUMN IF EXISTS former_names,
DROP COLUMN IF EXISTS coaster_stats,
DROP COLUMN IF EXISTS technical_specs;
-- Drop deprecated JSON column from ride_models table
ALTER TABLE ride_models
DROP COLUMN IF EXISTS technical_specs;
-- Add comments to document the relational approach
COMMENT ON TABLE ride_name_history IS 'Stores historical names for rides - replaces rides.former_names JSON column';
COMMENT ON TABLE ride_coaster_statistics IS 'Stores coaster statistics for rides - replaces rides.coaster_stats JSON column';
COMMENT ON TABLE ride_technical_specifications IS 'Stores technical specifications for rides - replaces rides.technical_specs JSON column';
COMMENT ON TABLE ride_model_technical_specifications IS 'Stores technical specifications for ride models - replaces ride_models.technical_specs JSON column';