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

@@ -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';