mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:51:12 -05:00
27 lines
1.1 KiB
SQL
27 lines
1.1 KiB
SQL
-- Add check constraints to enforce metric-only units in statistics tables
|
|
-- This ensures data integrity and compliance with the custom knowledge requirement:
|
|
-- "Unit Conversion Rules: Storage: Always metric in DB (km/h, m, cm, kg)"
|
|
|
|
-- Add constraint to ride_coaster_stats table
|
|
ALTER TABLE ride_coaster_stats
|
|
ADD CONSTRAINT ride_coaster_stats_metric_unit_check
|
|
CHECK (
|
|
unit IS NULL OR
|
|
unit IN ('km/h', 'm', 'cm', 'kg', 'g', 'G', 'celsius', 'seconds', 'minutes', 'hours', 'count', '%')
|
|
);
|
|
|
|
-- Add constraint to ride_technical_specifications table
|
|
ALTER TABLE ride_technical_specifications
|
|
ADD CONSTRAINT ride_tech_specs_metric_unit_check
|
|
CHECK (
|
|
unit IS NULL OR
|
|
unit IN ('km/h', 'm', 'cm', 'kg', 'g', 'G', 'celsius', 'seconds', 'minutes', 'hours', 'count', '%')
|
|
);
|
|
|
|
-- Add constraint to ride_model_technical_specifications table
|
|
ALTER TABLE ride_model_technical_specifications
|
|
ADD CONSTRAINT ride_model_tech_specs_metric_unit_check
|
|
CHECK (
|
|
unit IS NULL OR
|
|
unit IN ('km/h', 'm', 'cm', 'kg', 'g', 'G', 'celsius', 'seconds', 'minutes', 'hours', 'count', '%')
|
|
); |