diff options
author | Frederick Muriuki Muriithi | 2023-03-13 06:25:13 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-03-13 06:25:13 +0300 |
commit | 3dee24dc1e05893b49ace052ab61899e49a03bb7 (patch) | |
tree | a53e02f1c89288ed9808ff058fe9b258d6c39c56 /migrations/auth/20221114_05_hQun6-create-user-roles-table.py | |
parent | 08ab26292b9ed2da9e91a683f38c6e1f532af4ee (diff) | |
download | genenetwork3-3dee24dc1e05893b49ace052ab61899e49a03bb7.tar.gz |
Add 'ON UPDATE/DELETE' clauses to foreign keys.
Diffstat (limited to 'migrations/auth/20221114_05_hQun6-create-user-roles-table.py')
-rw-r--r-- | migrations/auth/20221114_05_hQun6-create-user-roles-table.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/migrations/auth/20221114_05_hQun6-create-user-roles-table.py b/migrations/auth/20221114_05_hQun6-create-user-roles-table.py index d9532dc..e0de751 100644 --- a/migrations/auth/20221114_05_hQun6-create-user-roles-table.py +++ b/migrations/auth/20221114_05_hQun6-create-user-roles-table.py @@ -13,8 +13,10 @@ steps = [ user_id TEXT NOT NULL, role_id TEXT NOT NULL, PRIMARY KEY(user_id, role_id), - FOREIGN KEY(user_id) REFERENCES users(user_id), + FOREIGN KEY(user_id) REFERENCES users(user_id) + ON UPDATE CASCADE ON DELETE RESTRICT, FOREIGN KEY(role_id) REFERENCES roles(role_id) + ON UPDATE CASCADE ON DELETE RESTRICT ) WITHOUT ROWID """, "DROP TABLE IF EXISTS user_roles"), |