-- Phase 3: Migrate 'day' precision to 'exact' across all tables
-- This fixes the check constraint violations and aligns with the new precision system

-- Parks
UPDATE parks 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE parks 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';

-- Park Submissions
UPDATE park_submissions 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE park_submissions 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';

-- Park Versions
UPDATE park_versions 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE park_versions 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';

-- Rides
UPDATE rides 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE rides 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';

-- Ride Submissions
UPDATE ride_submissions 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE ride_submissions 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';

-- Ride Versions
UPDATE ride_versions 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE ride_versions 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';

-- Companies
UPDATE companies 
SET founded_date_precision = 'exact' 
WHERE founded_date_precision = 'day';

-- Company Submissions
UPDATE company_submissions 
SET founded_date_precision = 'exact' 
WHERE founded_date_precision = 'day';

-- Company Versions
UPDATE company_versions 
SET founded_date_precision = 'exact' 
WHERE founded_date_precision = 'day';

-- Entity Timeline Events
UPDATE entity_timeline_events 
SET event_date_precision = 'exact' 
WHERE event_date_precision = 'day';

-- Timeline Event Submissions
UPDATE timeline_event_submissions 
SET event_date_precision = 'exact' 
WHERE event_date_precision = 'day';

-- Historical Parks
UPDATE historical_parks 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE historical_parks 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';

-- Historical Rides
UPDATE historical_rides 
SET opening_date_precision = 'exact' 
WHERE opening_date_precision = 'day';

UPDATE historical_rides 
SET closing_date_precision = 'exact' 
WHERE closing_date_precision = 'day';