|
@@ -1,8 +1,23 @@
|
|
|
# Generated by Django 4.2.1 on 2023-06-21 11:44
|
|
|
|
|
|
+from django import VERSION as DJANGO_VERSION
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
|
|
|
+check_constraint_condition = models.Q(
|
|
|
+ ("permission__isnull", False),
|
|
|
+ ("permission_type__isnull", False),
|
|
|
+ _connector="OR",
|
|
|
+)
|
|
|
+
|
|
|
+check_constraint_kwargs = {"name": "permission_or_permission_type_not_null"}
|
|
|
+
|
|
|
+if DJANGO_VERSION >= (5, 1):
|
|
|
+ check_constraint_kwargs["condition"] = check_constraint_condition
|
|
|
+else:
|
|
|
+ check_constraint_kwargs["check"] = check_constraint_condition
|
|
|
+
|
|
|
+
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
dependencies = [
|
|
@@ -16,14 +31,7 @@ class Migration(migrations.Migration):
|
|
|
),
|
|
|
migrations.AddConstraint(
|
|
|
model_name="grouppagepermission",
|
|
|
- constraint=models.CheckConstraint(
|
|
|
- check=models.Q(
|
|
|
- ("permission__isnull", False),
|
|
|
- ("permission_type__isnull", False),
|
|
|
- _connector="OR",
|
|
|
- ),
|
|
|
- name="permission_or_permission_type_not_null",
|
|
|
- ),
|
|
|
+ constraint=models.CheckConstraint(**check_constraint_kwargs),
|
|
|
),
|
|
|
migrations.AddConstraint(
|
|
|
model_name="grouppagepermission",
|