# Generated by Django 2.2.13 on 2020-11-21 00:18

from django.db import migrations

def load_default_types(apps, schema_editor):
    EveTimerType = apps.get_model('django_eveonline_timerboard', 'EveTimerType')
    types = [
        {
            "name": "Shield",
            "color": "Light Blue",
        },
        {
            "name": "Armor",
            "color": "Yellow",
        },
        {
            "name": "Structure",
            "color": "Red",
        }
    ]
    if EveTimerType.objects.all().count() == 0:
        for timer_type in types:
            EveTimerType.objects.create(name=timer_type['name'], color=timer_type['color'])

def unload_default_types(apps, schema_editor):
    EveTimerType = apps.get_model('django_eveonline_timerboard', 'EveTimerType')
    types = ['Shield', 'Armor', 'Structure']
    EveTimerType.objects.filter(name__in=types).delete()

class Migration(migrations.Migration):

    dependencies = [
        ('django_eveonline_timerboard', '0002_auto_20190917_2024'),
    ]

    operations = [
        migrations.RunPython(load_default_types, reverse_code=unload_default_types)
    ]
