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. --- migrations/auth/20221219_02_buSEU-create-oauth2-tokens-table.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'migrations/auth/20221219_02_buSEU-create-oauth2-tokens-table.py') diff --git a/migrations/auth/20221219_02_buSEU-create-oauth2-tokens-table.py b/migrations/auth/20221219_02_buSEU-create-oauth2-tokens-table.py index 81ca7df..778282b 100644 --- a/migrations/auth/20221219_02_buSEU-create-oauth2-tokens-table.py +++ b/migrations/auth/20221219_02_buSEU-create-oauth2-tokens-table.py @@ -21,8 +21,10 @@ steps = [ expires_in INTEGER NOT NULL, user_id TEXT NOT NULL, PRIMARY KEY(token_id), - FOREIGN KEY (client_id) REFERENCES oauth2_clients(client_id), + FOREIGN KEY (client_id) REFERENCES oauth2_clients(client_id) + ON UPDATE CASCADE ON DELETE RESTRICT, FOREIGN KEY (user_id) REFERENCES users(user_id) + ON UPDATE CASCADE ON DELETE RESTRICT ) WITHOUT ROWID """, "DROP TABLE IF EXISTS oauth2_tokens") -- cgit v1.2.3