From 425b26092f038accd2a5c5fc5a9bd3f82d4dd847 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Sat, 30 Mar 2024 14:15:03 +0100 Subject: [PATCH] Refs #35234 -- Skipped CheckConstraint system checks if not supported. Thanks Tim Graham for the report. Regression in 0fb104dda287431f5ab74532e45e8471e22b58c8. --- django/db/models/constraints.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/django/db/models/constraints.py b/django/db/models/constraints.py index e01a68e67b9..9c63a0940d8 100644 --- a/django/db/models/constraints.py +++ b/django/db/models/constraints.py @@ -200,7 +200,11 @@ class CheckConstraint(BaseConstraint): id="models.W027", ) ) - else: + elif ( + connection.features.supports_table_check_constraints + or "supports_table_check_constraints" + not in model._meta.required_db_features + ): references = set() condition = self.condition if isinstance(condition, Q):