diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-06 04:20:44 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-06 04:20:44 +0200 |
| commit | 81a07bfca08fda8ce762f2282d3bd5f6909dc923 (patch) | |
| tree | e93b93470403ce04003de9b8107555ea118f4ee5 | |
| parent | 3dea62f4b9421621ac15c87aee6d65150bb4295f (diff) | |
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.
| -rw-r--r-- | config/environments/test.rb | 2 |
1 files changed, 2 insertions, 0 deletions
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 | |||
| 42 | # Print deprecation notices to the stderr. | 42 | # Print deprecation notices to the stderr. |
| 43 | config.active_support.deprecation = :stderr | 43 | config.active_support.deprecation = :stderr |
| 44 | 44 | ||
| 45 | config.active_record.verify_foreign_keys_for_fixtures = false | ||
| 46 | |||
| 45 | # Raises error for missing translations. | 47 | # Raises error for missing translations. |
| 46 | # config.i18n.raise_on_missing_translations = true | 48 | # config.i18n.raise_on_missing_translations = true |
| 47 | 49 | ||
