diff --git a/src/open_inwoner/openzaak/migrations/0056_remove_zaaktypeconfig_unique_identificatie_in_catalogus_and_more.py b/src/open_inwoner/openzaak/migrations/0056_remove_zaaktypeconfig_unique_identificatie_in_catalogus_and_more.py deleted file mode 100644 index 5db9c561e0..0000000000 --- a/src/open_inwoner/openzaak/migrations/0056_remove_zaaktypeconfig_unique_identificatie_in_catalogus_and_more.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 4.2.16 on 2024-11-22 16:51 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("openzaak", "0055_openzaakconfig_zaken_filter_enabled"), - ] - - operations = [ - migrations.RemoveConstraint( - model_name="zaaktypeconfig", - name="unique_identificatie_in_catalogus", - ), - migrations.RemoveConstraint( - model_name="zaaktypeinformatieobjecttypeconfig", - name="unique_zaaktype_config_informatieobjecttype_url", - ), - migrations.RemoveConstraint( - model_name="zaaktyperesultaattypeconfig", - name="unique_zaaktype_config_resultaattype_url", - ), - migrations.RemoveConstraint( - model_name="zaaktypestatustypeconfig", - name="unique_zaaktype_config_statustype_url", - ), - ] diff --git a/src/open_inwoner/openzaak/models.py b/src/open_inwoner/openzaak/models.py index 635b901e2d..6cd772e439 100644 --- a/src/open_inwoner/openzaak/models.py +++ b/src/open_inwoner/openzaak/models.py @@ -555,6 +555,12 @@ class ZaakTypeConfig(models.Model): class Meta: verbose_name = _("Zaaktype Configuration") + constraints = [ + UniqueConstraint( + name="unique_identificatie_in_catalogus", + fields=["catalogus", "identificatie"], + ), + ] @property def catalogus_url(self): @@ -610,6 +616,12 @@ class ZaakTypeInformatieObjectTypeConfig(models.Model): class Meta: verbose_name = _("Zaaktype Information Object Configuration") + constraints = [ + UniqueConstraint( + name="unique_zaaktype_config_informatieobjecttype_url", + fields=["zaaktype_config", "informatieobjecttype_url"], + ) + ] def informatieobjecttype_uuid(self): if self.informatieobjecttype_url: @@ -742,6 +754,12 @@ class ZaakTypeStatusTypeConfig(models.Model): class Meta: verbose_name = _("Zaaktype Statustype Configuration") + constraints = [ + UniqueConstraint( + name="unique_zaaktype_config_statustype_url", + fields=["zaaktype_config", "statustype_url"], + ) + ] def __str__(self): return f"{self.zaaktype_config.identificatie} - {self.omschrijving} [{self.zaaktype_config.catalogus.base_url}]" @@ -786,6 +804,12 @@ class ZaakTypeResultaatTypeConfig(models.Model): class Meta: verbose_name = _("Zaaktype Resultaattype Configuration") + constraints = [ + UniqueConstraint( + name="unique_zaaktype_config_resultaattype_url", + fields=["zaaktype_config", "resultaattype_url"], + ) + ] def __str__(self): return f"{self.zaaktype_config.identificatie} - {self.omschrijving} [{self.zaaktype_config.catalogus.base_url}]" diff --git a/src/open_inwoner/openzaak/tests/test_import_export.py b/src/open_inwoner/openzaak/tests/test_import_export.py index 31e9df5fac..5258c54e6d 100644 --- a/src/open_inwoner/openzaak/tests/test_import_export.py +++ b/src/open_inwoner/openzaak/tests/test_import_export.py @@ -1,6 +1,7 @@ import dataclasses import io import uuid +from unittest import skip from django.core.files.storage.memory import InMemoryStorage from django.test import TestCase @@ -526,6 +527,7 @@ def test_import_jsonl_update_statustype_config_missing_zt_config(self): self.assertEqual(ZaakTypeStatusTypeConfig.objects.count(), 1) self.assertEqual(ZaakTypeResultaatTypeConfig.objects.count(), 1) + @skip("Disabled for v1.21.4 backport") def test_import_jsonl_update_reports_duplicate_db_records(self): mocks = ZGWExportImportMockData() @@ -565,6 +567,7 @@ def test_import_jsonl_update_reports_duplicate_db_records(self): # check import self.assertEqual(import_result, import_expected) + @skip("Disabled for v1.21.4 backport") def test_import_jsonl_update_reports_duplicate_natural_keys_in_upload_file(self): mocks = ZGWExportImportMockData(with_dupes=True)