diff --git a/src/open_inwoner/openzaak/migrations/0035_populate_zaaktypeconfig_urls.py b/src/open_inwoner/openzaak/migrations/0035_populate_zaaktypeconfig_urls.py index 6f4f3f3b40..1751c357e8 100644 --- a/src/open_inwoner/openzaak/migrations/0035_populate_zaaktypeconfig_urls.py +++ b/src/open_inwoner/openzaak/migrations/0035_populate_zaaktypeconfig_urls.py @@ -1,11 +1,12 @@ # Generated by Django 3.2.20 on 2023-11-20 10:07 +import logging + from django.core.exceptions import ObjectDoesNotExist -from django.db import migrations, transaction +from django.db import ProgrammingError, migrations, transaction -from open_inwoner.openzaak.zgw_imports import get_configurable_zaaktypes from open_inwoner.openzaak.clients import build_client -import logging +from open_inwoner.openzaak.zgw_imports import get_configurable_zaaktypes logger = logging.getLogger(__name__) @@ -18,16 +19,20 @@ def populate_zaaktype_config_urls(apps, schema_editor): CatalogusConfig = apps.get_model("openzaak", "CatalogusConfig") catalog_lookup = {c.url: c for c in CatalogusConfig.objects.all()} - client = build_client("catalogi") - if not client: - logger.warning( - "Not populating zaaktype config urls: could not build Catalogi API client" - ) - return [] + try: + client = build_client("catalogi") + if not client: + logger.warning( + "Not populating zaaktype config urls: could not build Catalogi API client" + ) + return [] + + zaaktypes = get_configurable_zaaktypes(client) + if not zaaktypes: + return [] - zaaktypes = get_configurable_zaaktypes(client) - if not zaaktypes: - return [] + except ProgrammingError: + pass with transaction.atomic(): for zaaktype in zaaktypes: