mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 11:31:11 -05:00
feat: Add Phase 9B indexes
This commit is contained in:
@@ -0,0 +1,88 @@
|
|||||||
|
-- Phase 9B: Add Medium-Priority Foreign Key Indexes
|
||||||
|
-- These support less-frequent operations like historical data lookups and audit trails
|
||||||
|
|
||||||
|
-- Historical data foreign keys (4 indexes)
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_historical_parks_location_id
|
||||||
|
ON historical_parks(location_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_historical_parks_successor_park_id
|
||||||
|
ON historical_parks(successor_park_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_historical_rides_relocated_to_park_id
|
||||||
|
ON historical_rides(relocated_to_park_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_historical_rides_successor_ride_id
|
||||||
|
ON historical_rides(successor_ride_id);
|
||||||
|
|
||||||
|
-- Audit trail foreign keys (5 indexes)
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_admin_settings_updated_by
|
||||||
|
ON admin_settings(updated_by);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_profile_audit_log_changed_by
|
||||||
|
ON profile_audit_log(changed_by);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_contact_submissions_resolved_by
|
||||||
|
ON contact_submissions(resolved_by);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_contact_submissions_archived_by
|
||||||
|
ON contact_submissions(archived_by);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_user_roles_granted_by
|
||||||
|
ON user_roles(granted_by);
|
||||||
|
|
||||||
|
-- Submission tracking foreign keys (5 indexes)
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_company_versions_submission_id
|
||||||
|
ON company_versions(submission_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_ride_model_versions_submission_id
|
||||||
|
ON ride_model_versions(submission_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_ride_model_versions_manufacturer_id
|
||||||
|
ON ride_model_versions(manufacturer_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_ride_models_manufacturer_id
|
||||||
|
ON ride_models(manufacturer_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_park_submissions_location_id
|
||||||
|
ON park_submissions(location_id);
|
||||||
|
|
||||||
|
-- Location/timeline foreign keys (8 indexes)
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_park_location_history_park_id
|
||||||
|
ON park_location_history(park_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_park_location_history_old_location_id
|
||||||
|
ON park_location_history(old_location_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_park_location_history_new_location_id
|
||||||
|
ON park_location_history(new_location_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_park_operating_hours_park_id
|
||||||
|
ON park_operating_hours(park_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_entity_timeline_events_from_location_id
|
||||||
|
ON entity_timeline_events(from_location_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_entity_timeline_events_to_location_id
|
||||||
|
ON entity_timeline_events(to_location_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_timeline_event_submissions_from_location_id
|
||||||
|
ON timeline_event_submissions(from_location_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_timeline_event_submissions_to_location_id
|
||||||
|
ON timeline_event_submissions(to_location_id);
|
||||||
|
|
||||||
|
-- Miscellaneous relationship foreign keys (6 indexes)
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_contact_email_threads_sent_by
|
||||||
|
ON contact_email_threads(sent_by);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_notification_logs_template_id
|
||||||
|
ON notification_logs(template_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_review_deletions_park_id
|
||||||
|
ON review_deletions(park_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_review_deletions_ride_id
|
||||||
|
ON review_deletions(ride_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_user_blocks_blocked_id
|
||||||
|
ON user_blocks(blocked_id);
|
||||||
Reference in New Issue
Block a user