# Generated by Django 2.2.19 on 2021-06-01 10:58

import datetime
from django.db import migrations


def ints_to_dates(apps, schema_editor):
    Visits = apps.get_model('stats', 'Visits')
    for visit in Visits.objects.all():
        visit.date = datetime.date(visit.year, visit.month, 1)
        visit.save()

def dates_to_ints(apps, schema_editor):
    Visits = apps.get_model('stats', 'Visits')
    for visit in Visits.objects.all():
        visit.year = visit.date.year
        visit.month = visit.date.month
        visit.save()


class Migration(migrations.Migration):

    dependencies = [
        ('stats', '0002_visits_date'),
    ]

    operations = [
        migrations.RunPython(ints_to_dates, dates_to_ints)
    ]
