Skip to content

Commit e10037a

Browse files
committed
SQL: Add ON DELETE CASCADE
that allows deleting data from tables events and sent without manually deleting the corresponding entries from the directives. There's no value in blocking the deletion of entries in the table directives, which are obsolete anyway, when one wants to delete entries from the events table.
1 parent f350ede commit e10037a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sql/notifications.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ CREATE TABLE directives (
6767

6868
inserted_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
6969

70-
FOREIGN KEY (events_id) REFERENCES events(id),
71-
FOREIGN KEY (sent_id) REFERENCES sent(id)
70+
FOREIGN KEY (events_id) REFERENCES events(id) ON DELETE CASCADE,
71+
FOREIGN KEY (sent_id) REFERENCES sent(id) ON DELETE CASCADE
7272
);
7373

7474

0 commit comments

Comments
 (0)