# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-01-07 12:12
from __future__ import unicode_literals

from django.db import migrations, models
from django.conf import settings


def remove_stale_domains(apps, schema_editor):
    if hasattr(settings, "URL_CONFIG") and settings.URL_CONFIG == "path":
        Journal = apps.get_model("journal", "Journal")
        Journal.objects.all().update(domain=None)


class Migration(migrations.Migration):
    dependencies = [
        ("journal", "0046_auto_20210922_1436"),
    ]

    operations = [
        migrations.AlterField(
            model_name="journal",
            name="domain",
            field=models.CharField(blank=True, max_length=255, null=True, unique=True),
        ),
        migrations.RunPython(
            remove_stale_domains, reverse_code=migrations.RunPython.noop
        ),
    ]
