Merge pull request #1157 from ae-utbm/checkconstraint

replace deprecated CheckConstraint.check by CheckConstraint.condition
This commit is contained in:
thomas girod
2025-08-29 00:45:41 +02:00
committed by GitHub
8 changed files with 8 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="membership",
constraint=models.CheckConstraint(
check=models.Q(("end_date__gte", models.F("start_date"))),
condition=models.Q(("end_date__gte", models.F("start_date"))),
name="end_after_start",
),
),

View File

@@ -347,7 +347,7 @@ class Membership(models.Model):
class Meta:
constraints = [
models.CheckConstraint(
check=Q(end_date__gte=F("start_date")), name="end_after_start"
condition=Q(end_date__gte=F("start_date")), name="end_after_start"
),
]

View File

@@ -54,7 +54,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="newsdate",
constraint=models.CheckConstraint(
check=models.Q(("end_date__gte", models.F("start_date"))),
condition=models.Q(("end_date__gte", models.F("start_date"))),
name="news_date_end_date_after_start_date",
),
),

View File

@@ -212,7 +212,7 @@ class NewsDate(models.Model):
verbose_name_plural = _("news dates")
constraints = [
models.CheckConstraint(
check=Q(end_date__gte=F("start_date")),
condition=Q(end_date__gte=F("start_date")),
name="news_date_end_date_after_start_date",
)
]

View File

@@ -154,7 +154,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="userban",
constraint=models.CheckConstraint(
check=models.Q(("expires_at__gte", models.F("created_at"))),
condition=models.Q(("expires_at__gte", models.F("created_at"))),
name="user_ban_end_after_start",
),
),

View File

@@ -745,7 +745,7 @@ class UserBan(models.Model):
fields=["ban_group", "user"], name="unique_ban_type_per_user"
),
models.CheckConstraint(
check=Q(expires_at__gte=F("created_at")),
condition=Q(expires_at__gte=F("created_at")),
name="user_ban_end_after_start",
),
]

View File

@@ -58,7 +58,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="returnableproduct",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
("product", models.F("returned_product")), _negated=True
),
name="returnableproduct_product_different_from_returned",

View File

@@ -1278,7 +1278,7 @@ class ReturnableProduct(models.Model):
verbose_name_plural = _("returnable products")
constraints = [
models.CheckConstraint(
check=~Q(product=F("returned_product")),
condition=~Q(product=F("returned_product")),
name="returnableproduct_product_different_from_returned",
violation_error_message=_(
"The returnable product cannot be the same as the returned one"