# Generated by Django 3.2.5 on 2021-07-19 11:17

from django.db import migrations


def migrate_gift_card_data(apps, schema):
    GiftCard = apps.get_model("giftcard", "GiftCard")
    for gift_card in GiftCard.objects.iterator():
        gift_card.expiry_date = gift_card.end_date
        gift_card.created_by = gift_card.user
        gift_card.created_by_email = gift_card.user.email if gift_card.user else None
        gift_card.save()


class Migration(migrations.Migration):

    dependencies = [
        ("giftcard", "0005_auto_20210719_1116"),
    ]

    operations = [
        migrations.RunPython(migrate_gift_card_data, migrations.RunPython.noop),
    ]
