-- Fix entity_timeline_events event_type constraint to include 'opening'
ALTER TABLE public.entity_timeline_events 
DROP CONSTRAINT IF EXISTS entity_timeline_events_event_type_check;

ALTER TABLE public.entity_timeline_events 
ADD CONSTRAINT entity_timeline_events_event_type_check 
CHECK (event_type IN (
  'name_change',
  'operator_change', 
  'owner_change',
  'location_change',
  'status_change',
  'opening',
  'closure',
  'reopening',
  'renovation',
  'expansion',
  'acquisition',
  'milestone',
  'other'
));

-- Add 'milestone' to content_submissions submission_type constraint
ALTER TABLE public.content_submissions 
DROP CONSTRAINT IF EXISTS content_submissions_submission_type_check;

ALTER TABLE public.content_submissions 
ADD CONSTRAINT content_submissions_submission_type_check 
CHECK (submission_type IN (
  'park', 
  'ride', 
  'review', 
  'photo', 
  'manufacturer', 
  'operator', 
  'designer', 
  'property_owner',
  'photo_edit',
  'photo_delete',
  'ride_model',
  'milestone'
));

COMMENT ON CONSTRAINT content_submissions_submission_type_check ON public.content_submissions IS 
'milestone submissions are for entity timeline/historical events';