# Generated by Django 2.1.5 on 2019-01-30 16:34

from django.db import migrations


def initialize_data(apps, schema_editor):
    data = [
        {"model": "pyfb_kamailio.version", "pk": 1, "fields": {"table_name": "acc", "table_version": 5}}, {"model": "pyfb_kamailio.version", "pk": 2, "fields": {"table_name": "acc_cdrs", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 3, "fields": {"table_name": "missed_calls", "table_version": 4}}, {"model": "pyfb_kamailio.version", "pk": 4, "fields": {"table_name": "dbaliases", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 5, "fields": {"table_name": "subscriber", "table_version": 7}}, {"model": "pyfb_kamailio.version", "pk": 6, "fields": {"table_name": "usr_preferences", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 7, "fields": {"table_name": "dialog", "table_version": 7}}, {"model": "pyfb_kamailio.version", "pk": 8, "fields": {"table_name": "dialog_vars", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 9, "fields": {"table_name": "dialplan", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 10, "fields": {"table_name": "dispatcher", "table_version": 4}}, {"model": "pyfb_kamailio.version", "pk": 11, "fields": {"table_name": "domain", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 12, "fields": {"table_name": "domain_attrs", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 13, "fields": {"table_name": "domainpolicy", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 14, "fields": {"table_name": "grp", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 15, "fields": {"table_name": "re_grp", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 16, "fields": {"table_name": "htable", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 17, "fields": {"table_name": "mtree", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 18, "fields": {"table_name": "mtrees", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 19, "fields": {"table_name": "trusted", "table_version": 6}}, {"model": "pyfb_kamailio.version", "pk": 20, "fields": {"table_name": "address", "table_version": 6}}, {"model": "pyfb_kamailio.version", "pk": 21, "fields": {"table_name": "pl_pipes", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 22, "fields": {"table_name": "aliases", "table_version": 8}}, {"model": "pyfb_kamailio.version", "pk": 23, "fields": {"table_name": "rtpengine", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 24, "fields": {"table_name": "sip_trace", "table_version": 4}}, {"model": "pyfb_kamailio.version", "pk": 25, "fields": {"table_name": "speed_dial", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 26, "fields": {"table_name": "version", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 27, "fields": {"table_name": "uacreg", "table_version": 3}}, {"model": "pyfb_kamailio.version", "pk": 28, "fields": {"table_name": "uid_credentials", "table_version": 7}}, {"model": "pyfb_kamailio.version", "pk": 29, "fields": {"table_name": "uid_user_attrs", "table_version": 3}}, {"model": "pyfb_kamailio.version", "pk": 30, "fields": {"table_name": "uid_domain", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 31, "fields": {"table_name": "uid_domain_attrs", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 32, "fields": {"table_name": "uid_global_attrs", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 33, "fields": {"table_name": "uid_uri", "table_version": 3}}, {"model": "pyfb_kamailio.version", "pk": 34, "fields": {"table_name": "uid_uri_attrs", "table_version": 2}}, {"model": "pyfb_kamailio.version", "pk": 35, "fields": {"table_name": "uri", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 36, "fields": {"table_name": "userblacklist", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 37, "fields": {"table_name": "globalblacklist", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 38, "fields": {"table_name": "location", "table_version": 9}}, {"model": "pyfb_kamailio.version", "pk": 39, "fields": {"table_name": "location_attrs", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 40, "fields": {"table_name": "cpl", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 41, "fields": {"table_name": "topos_d", "table_version": 1}}, {"model": "pyfb_kamailio.version", "pk": 42, "fields": {"table_name": "topos_t", "table_version": 1}}
    ]

    for record in data:
        app_name, model_name = record['model'].split('.')
        ModelClass = apps.get_model(app_name, model_name)
        obj = ModelClass(**record['fields'])
        # this is required only if you have other models
        # with foreign keys referring to this object
        # obj.pk = record['pk']
        obj.save()


class Migration(migrations.Migration):

    dependencies = [
        ('pyfb_kamailio', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(initialize_data),
    ]
