Skip to content

Commit

Permalink
Handle different postgres constraint names
Browse files Browse the repository at this point in the history
Hopefully the rest of the upgrade will still fail if the name is
neither of these options
  • Loading branch information
tulir committed Dec 31, 2023
1 parent 9fed988 commit 2dac1db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion database/upgrades/16-refactor-postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ ALTER TABLE reaction ADD COLUMN _part_index INTEGER NOT NULL DEFAULT 0;

-- Re-add the dropped constraints (but with part index and no chat)
ALTER TABLE message ADD PRIMARY KEY (sender, timestamp, part_index, signal_receiver);
ALTER TABLE message DROP CONSTRAINT message_signal_chat_id_signal_receiver_fkey;
ALTER TABLE message DROP CONSTRAINT IF EXISTS message_signal_chat_id_signal_receiver_fkey;
ALTER TABLE message DROP CONSTRAINT IF EXISTS message_signal_chat_id_fkey;
ALTER TABLE message ADD CONSTRAINT message_portal_fkey
FOREIGN KEY (signal_chat_id, signal_receiver)
REFERENCES portal (chat_id, receiver)
Expand Down

0 comments on commit 2dac1db

Please sign in to comment.