# SPDX-FileCopyrightText: 2021-present Tobias Kunze
# SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms

# Generated by Django 3.2.4 on 2021-12-02 17:14

from django.db import migrations


def update_custom_domain(apps, schema_editor):
    EventSettings = apps.get_model("event", "Event_SettingsStore")
    for setting in EventSettings.objects.filter(
        key="custom_domain", value__isnull=False
    ):
        setting.object.custom_domain = setting.value
        setting.object.save()


class Migration(migrations.Migration):
    dependencies = [
        ("event", "0028_custom_event_data"),
    ]

    operations = [migrations.RunPython(update_custom_domain, migrations.RunPython.noop)]
