# Generated by Django 2.2 on 2019-06-26 15:49

from django.db import migrations



def add_keys(apps, schema_editor):
    '''
    We can't import the Post model directly as it may be a newer
    version than this migration expects. We use the historical version.
    '''
    Review = apps.get_model('reviews', 'Review')
    for obj in Review.objects.all():
        obj.user_obj_2 = obj.user_obj
        obj.save()


def remove_keys(apps, schema_editor):
    '''
    We can't import the Post model directly as it may be a newer
    version than this migration expects. We use the historical version.
    '''
    # FileField = apps.get_model('filefields', 'FileField')
    Review = apps.get_model('reviews', 'Review')
    for obj in Review.objects.all():
        obj.user_obj = obj.user_obj_2
        obj.save()



class Migration(migrations.Migration):

    dependencies = [
        ('reviews', '0009_review_user_obj_2'),
    ]

    operations = [
        migrations.RunPython(add_keys, reverse_code=remove_keys),
    ]
