# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-04-26 09:09
from __future__ import unicode_literals

from django.db import migrations
from atmo.jobs.schedules import SparkJobSchedule


def save_schedules(apps, schema_editor):
    SparkJob = apps.get_model("jobs", "SparkJob")

    for job in SparkJob.objects.all():
        SparkJobSchedule(job).add()


def delete_schedules(apps, schema_editor):
    SparkJob = apps.get_model("jobs", "SparkJob")

    for job in SparkJob.objects.all():
        SparkJobSchedule(job).delete()


class Migration(migrations.Migration):

    dependencies = [("jobs", "0024_auto_20170425_1324")]

    operations = [migrations.RunPython(save_schedules, delete_schedules)]
