Skip to content

Commit ddc1c48

Browse files
michotmvincent-hatakeyama
authored andcommitted
[MIG] sql constraint in model.constraint
1 parent 9e275c1 commit ddc1c48

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

auth_saml/models/res_users_saml.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ class ResUserSaml(models.Model):
1818
help="The current SAML token in use",
1919
)
2020

21-
_sql_constraints = [
22-
(
23-
"uniq_users_saml_provider_saml_uid",
24-
"unique(saml_provider_id, saml_uid)",
25-
"SAML UID must be unique per provider",
26-
)
27-
]
21+
_unique_saml_uid_per_provider = models.Constraint(
22+
"unique (saml_provider_id, saml_uid)",
23+
"SAML UID must be unique per provider",
24+
)
2825

2926
@api.model_create_multi
3027
def create(self, vals_list):

0 commit comments

Comments
 (0)