# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-15 14:13
from __future__ import unicode_literals

from django.db import migrations


def forwards_func(apps, schema_editor):
    # We get the model from the versioned app registry;
    # if we directly import it, it'll be the wrong version
    Role = apps.get_model('accounts', 'Role')
    db_alias = schema_editor.connection.alias
    Role.objects.using(db_alias).bulk_create([
        Role(system=True, hrid='admin', display='Admin'),
    ])


def reverse_func(apps, schema_editor):
    # forwards_func() creates two Country instances,
    # so reverse_func() should delete them.
    Role = apps.get_model('accounts', 'Role')
    db_alias = schema_editor.connection.alias
    Role.objects.using(db_alias).filter(system=True, hrid='admin').delete()


class Migration(migrations.Migration):

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

    operations = [
        migrations.RunPython(forwards_func, reverse_func),
    ]
