From 3dee24dc1e05893b49ace052ab61899e49a03bb7 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 13 Mar 2023 06:25:13 +0300 Subject: Add 'ON UPDATE/DELETE' clauses to foreign keys. --- .../auth/20221114_01_n8gsF-create-generic-role-privileges-table.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'migrations/auth/20221114_01_n8gsF-create-generic-role-privileges-table.py') diff --git a/migrations/auth/20221114_01_n8gsF-create-generic-role-privileges-table.py b/migrations/auth/20221114_01_n8gsF-create-generic-role-privileges-table.py index 7102a57..2048f4a 100644 --- a/migrations/auth/20221114_01_n8gsF-create-generic-role-privileges-table.py +++ b/migrations/auth/20221114_01_n8gsF-create-generic-role-privileges-table.py @@ -15,8 +15,10 @@ steps = [ generic_role_id TEXT NOT NULL, privilege_id TEXT NOT NULL, PRIMARY KEY(generic_role_id, privilege_id), - FOREIGN KEY(generic_role_id) REFERENCES generic_roles(role_id), + FOREIGN KEY(generic_role_id) REFERENCES generic_roles(role_id) + ON UPDATE CASCADE ON DELETE RESTRICT, FOREIGN KEY(privilege_id) REFERENCES privileges(privilege_id) + ON UPDATE CASCADE ON DELETE RESTRICT ) WITHOUT ROWID """, "DROP TABLE IF EXISTS generic_role_privileges"), -- cgit v1.2.3