diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-06 04:36:36 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-06 04:36:36 +0200 |
| commit | 7384522a84e0f1d80ff471e4023f865c84768b2c (patch) | |
| tree | 95013360a3086e6f410e3f2fd8645721826d525f /script/generate | |
| parent | 394a2b890686cadd7a3ecb0038ce5d0b744431f4 (diff) | |
Add FK with ON DELETE CASCADE on occurrences.event_id
Was the last remaining gap in the occurrence-orphaning fix from earlier
this session: dependent: :destroy on Event#occurrences covers deletion
through ActiveRecord, this covers anything that bypasses it (raw SQL,
Model.delete). Confirmed zero existing orphans and zero NULL event_ids
before adding the constraint (event_id stays nullable - an occurrence
without an event is valid, one with a bogus event_id is not). Also adds
the index that should have existed on this column already - Postgres
needs one for the cascade to be anything other than a full table scan
per delete, and none existed before this. deferrable: :immediate added
so legitimate application code can still defer the check within a
transaction if ever needed - unrelated to, and not a fix for, the
fixture-loading issue below.
Applying this constraint broke fixture loading entirely (config fix:
81a07bf) and exposed a live bug in events#index (fix: 970f108), both
already committed separately - this migration file itself just never
got staged until now.
Diffstat (limited to 'script/generate')
0 files changed, 0 insertions, 0 deletions
