# Generated by Django 3.0.4 on 2020-04-01 19:56

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


def delete_old_elections(apps, schema_editor) -> None:  # type: ignore
    # we need to remove all the previously created elections
    # as they didn't have any author assigned and new permissions
    # would make them unusable anyway
    Election = apps.get_model("elections.Election")
    Election.objects.all().delete()


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("elections", "0001_initial"),
    ]

    operations = [
        migrations.RunPython(delete_old_elections),
    ]
