# Generated by Django 2.2.7 on 2019-11-10 16:22
from decimal import Decimal

from django.db import migrations


def forward_function(apps, schema_editor):
    db_alias = schema_editor.connection.alias
    Branch = apps.get_model("branches", "Branch")
    branches = []
    for i in range(1, 11):
        branches.append(
            Branch(
                name="mock_Branch_{}".format(i),
                latitude=Decimal("{}.000000".format(50 + i)),
                longitude=Decimal("{}.000000".format(50 + i)),
            )
        )

    Branch.objects.using(db_alias).bulk_create(branches)


def reverse_function(apps, schema_editor):
    db_alias = schema_editor.connection.alias
    Branch = apps.get_model("branches", "Branch")
    Branch.objects.using(db_alias).filter(name__startswith="mock_").delete()


class Migration(migrations.Migration):

    dependencies = [("branches", "0003_auto_20191110_1920")]

    operations = [migrations.RunPython(forward_function, reverse_function)]
