# Generated by Django 2.2.13 on 2020-08-12 08:15

from django.db import migrations


def populate_wto_barrier_ids(apps, schema_editor):
    BarrierInstance = apps.get_model("barriers", "BarrierInstance")

    for barrier in BarrierInstance.objects.filter(wto_profile__isnull=False):
        wto_profile = barrier.wto_profile
        wto_profile.barrier = barrier
        wto_profile.save()


class Migration(migrations.Migration):

    dependencies = [
        ("wto", "0004_auto_20200812_0815"),
    ]

    operations = [
        migrations.RunPython(
            populate_wto_barrier_ids, reverse_code=migrations.RunPython.noop
        ),
    ]
