From 81a07bfca08fda8ce762f2282d3bd5f6909dc923 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Mon, 6 Jul 2026 04:20:44 +0200 Subject: Disable verify_foreign_keys_for_fixtures for test env Adding the occurrences.event_id FK constraint broke fixture loading entirely (every test failing at setup) with a misleading "Foreign key violations found in your fixture data" error. The real cause: this Rails feature does its own proactive integrity check during fixture insertion, independent of the constraint's own deferrability, by directly flipping pg_constraint.convalidated and re-validating - which needs catalog-level privilege the app's DB role correctly doesn't have. No actual fixture data was ever invalid; the check itself couldn't run. Scoped to test.rb only - this never affected real application behavior, and Postgres still fully enforces the actual constraint everywhere, in every environment, regardless of this setting. --- config/environments/test.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config') diff --git a/config/environments/test.rb b/config/environments/test.rb index bb89065..08fcefa 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -42,6 +42,8 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + config.active_record.verify_foreign_keys_for_fixtures = false + # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true -- cgit v1.3