[FIX] base: Make user apikeys ondelete cascade on user_id

This could prevent the user deletion if linked to a record of this
type, like a auth_totp.device which inherits from this model.

Part-of: odoo/odoo#114656
This commit is contained in:
Yannick Tivisse
2023-03-13 13:13:48 +01:00
parent 4518a768eb
commit 9aa04f18d9
+1 -1
View File
@@ -1990,7 +1990,7 @@ class APIKeys(models.Model):
CREATE TABLE IF NOT EXISTS {table} (
id serial primary key,
name varchar not null,
user_id integer not null REFERENCES res_users(id),
user_id integer not null REFERENCES res_users(id) ON DELETE CASCADE,
scope varchar,
index varchar({index_size}) not null CHECK (char_length(index) = {index_size}),
key varchar not null,