# Generated by Django 2.2.24 on 2021-08-03 17:47

from django.db import migrations


def set_streetmodel_resource(apps, schema_editor):
    BaseAdresse = apps.get_model("base_adresse", "BaseAdresse")
    StreetModel = apps.get_model("base_adresse", "StreetModel")
    if BaseAdresse.objects.exists():
        StreetModel.objects.update(resource=BaseAdresse.objects.first())
    else:
        StreetModel.objects.all().delete()


class Migration(migrations.Migration):

    dependencies = [
        ("base_adresse", "0019_streetmodel_resource_add"),
    ]

    operations = [
        migrations.RunPython(set_streetmodel_resource),
    ]
