1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Refs #30060, Refs #34217 -- Made SchemaEditor not generate SQL for CheckConstraint if not supported.

The new logic mirrors the logic in SchemaEditor._delete_check_sql()
added in 68ef274bc5.

Thanks Tim Graham for the report.
This commit is contained in:
Mariusz Felisiak
2023-02-23 21:12:17 +01:00
committed by GitHub
parent 5b3d3e400a
commit 16c966ff7f
2 changed files with 24 additions and 5 deletions

View File

@@ -1726,6 +1726,8 @@ class BaseDatabaseSchemaEditor:
}
def _create_check_sql(self, model, name, check):
if not self.connection.features.supports_table_check_constraints:
return None
return Statement(
self.sql_create_check,
table=Table(model._meta.db_table, self.quote_name),