# Generated by Django 2.2.10 on 2020-02-17 11:27

from django.conf import settings
from django.contrib.auth.models import User as AuthUser
from django.db import migrations
from django.db.migrations import RunPython


def forwards(apps, schema_editor):
    User = apps.get_model(*settings.AUTH_USER_MODEL.split("."))  # type: AuthUser
    for username in ["datahub", "dataworkspace", "email", "directoryforms"]:
        user, _ = User.objects.get_or_create(username=username)


def backwards(apps, schema_editor):
    User = apps.get_model(*settings.AUTH_USER_MODEL.split("."))  # type: AuthUser
    User.objects.filter(
        username__in=["datahub", "dataworkspace", "email", "directoryforms"]
    ).delete()


class Migration(migrations.Migration):

    dependencies = [
        ("poller", "0001_initial"),
    ]

    operations = [RunPython(forwards, backwards)]
