# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-05 20:03
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


def create_initial_mapupdate(apps, schema_editor):
    MapUpdate = apps.get_model('mapdata', 'MapUpdate')
    MapUpdate.objects.create(type='initial')

def delete_initial_mapupdate(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('mapdata', '0013_auto_20170618_1934'),
    ]

    operations = [
        migrations.CreateModel(
            name='MapUpdate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('datetime', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('type', models.CharField(max_length=32)),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='mapupdates', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Map update',
                'verbose_name_plural': 'Map updates',
                'get_latest_by': 'datetime',
                'default_related_name': 'mapupdates',
            },
        ),
        migrations.RunPython(create_initial_mapupdate, delete_initial_mapupdate),
    ]
