summaryrefslogtreecommitdiff
path: root/app/models/node.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-06 04:36:36 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-06 04:36:36 +0200
commit7384522a84e0f1d80ff471e4023f865c84768b2c (patch)
tree95013360a3086e6f410e3f2fd8645721826d525f /app/models/node.rb
parent394a2b890686cadd7a3ecb0038ce5d0b744431f4 (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 'app/models/node.rb')
0 files changed, 0 insertions, 0 deletions