-- +goose Up -- Indexes for the cascading foreign keys of 00002 (PD-11): deleting a chapter or a unit otherwise -- scans the child table once per deleted row, and re-chunking a book deletes thousands. create index notes_chapter_idx on notes (chapter_id); create index bank_decisions_term_idx on bank_decisions (term_id); -- The referenced key for the reservation's composite foreign key (00007): it is what makes -- "charging account A for account B's book" impossible in the database rather than in a check the -- next caller has to remember. create unique index books_id_owner_idx on books (id, owner_id); -- +goose Down drop index books_id_owner_idx; drop index bank_decisions_term_idx; drop index notes_chapter_idx;