# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-06-06 12:36
from __future__ import unicode_literals

from django.db import migrations, models


def updated_offerings(apps, schema_editor):
    # Update value of terminated_at field with value of modified field
    Offering = apps.get_model('support', 'Offering')
    Offering.objects.filter(state='terminated').update(terminated_at=models.F('modified'))


class Migration(migrations.Migration):

    dependencies = [
        ('support', '0017_unique_backend_id'),
    ]

    operations = [
        migrations.AddField(
            model_name='offering',
            name='terminated_at',
            field=models.DateTimeField(blank=True, editable=False, null=True),
        ),
        migrations.RunPython(updated_offerings, elidable=True)
    ]
