# Generated by Django 4.2.7 on 2023-12-19 17:51

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
    dependencies = [
        ("mapdata", "0091_area_main_point"),
    ]

    operations = [
        migrations.AddField(
            model_name="accesspermission",
            name="access_restriction_group",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="mapdata.accessrestrictiongroup",
            ),
        ),
        migrations.AlterField(
            model_name="accesspermission",
            name="access_restriction",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="mapdata.accessrestriction",
            ),
        ),
        migrations.AddConstraint(
            model_name="accesspermission",
            constraint=models.CheckConstraint(
                check=models.Q(
                    models.Q(
                        ("access_restriction__isnull", True),
                        ("access_restriction_group__isnull", True),
                        _negated=True,
                    ),
                    models.Q(
                        ("access_restriction__isnull", False),
                        ("access_restriction_group__isnull", False),
                        _negated=True,
                    ),
                ),
                name="permission_needs_restriction_or_restriction_group",
            ),
        ),
    ]
