Files
gupi-osint-board/migrations/016_dialogue_step_npc_cascade.sql
T

8 lines
488 B
SQL
Raw Normal View History

-- A dialogue step is meaningless without its speaker. Cascade deletes from npcs
-- so that removing an NPC (or dropping a whole mystery, which cascades to its
-- cast) also removes the steps that reference it, rather than failing on the
-- non-cascading foreign key.
ALTER TABLE osint.dialogue_steps DROP CONSTRAINT dialogue_steps_npc_id_fkey;
ALTER TABLE osint.dialogue_steps ADD CONSTRAINT dialogue_steps_npc_id_fkey
FOREIGN KEY (npc_id) REFERENCES osint.npcs(id) ON DELETE CASCADE;