# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import mtp.apps.common.utils
import django_extensions.db.fields


class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ClientVersion',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(blank=True, primary_key=True, serialize=False, editable=False)),
                ('name', models.CharField(max_length=30, db_index=True)),
                ('bundle_name', models.CharField(max_length=255)),
                ('version', models.PositiveIntegerField(db_index=True)),
                ('file', models.FileField(upload_to=mtp.apps.common.utils.upload_to_generator)),
                ('hash', models.CharField(blank=True, max_length=36, null=True)),
            ],
            options={
                'ordering': ('-version',),
            },
        ),
        migrations.CreateModel(
            name='LocalServer',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(blank=True, primary_key=True, serialize=False, editable=False)),
                ('mac', models.CharField(max_length=50, unique=True)),
                ('name', models.CharField(blank=True, max_length=150)),
                ('currently_update', models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='LocalServerConnection',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(db_index=True, auto_now_add=True)),
                ('time', models.PositiveIntegerField(default=1)),
                ('update_count', models.PositiveIntegerField(default=0)),
                ('local_server', models.ForeignKey(to='sync.LocalServer')),
            ],
        ),
        migrations.CreateModel(
            name='ServerVersion',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(blank=True, primary_key=True, serialize=False, editable=False)),
                ('name', models.CharField(max_length=30, db_index=True)),
                ('version', models.PositiveIntegerField(db_index=True)),
                ('file', models.FileField(upload_to=mtp.apps.common.utils.upload_to_generator)),
                ('hash', models.CharField(blank=True, max_length=36, null=True)),
            ],
            options={
                'ordering': ('name', '-version'),
            },
        ),
        migrations.CreateModel(
            name='Task',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(db_index=True, auto_now_add=True)),
                ('path', models.CharField(max_length=1000)),
                ('done', models.BooleanField(db_index=True, default=False)),
                ('finish_path', models.CharField(max_length=1000)),
            ],
            options={
                'ordering': ('done', 'date'),
            },
        ),
        migrations.CreateModel(
            name='Update',
            fields=[
                ('id', django_extensions.db.fields.UUIDField(blank=True, primary_key=True, serialize=False, editable=False)),
                ('date', models.DateTimeField(db_index=True, auto_now_add=True)),
                ('healthy', models.BooleanField(default=False)),
                ('synchronized', models.BooleanField(default=False)),
            ],
            options={
                'ordering': ('-date',),
            },
        ),
        migrations.AlterIndexTogether(
            name='task',
            index_together=set([('done', 'date')]),
        ),
        migrations.AddField(
            model_name='serverversion',
            name='first_update',
            field=models.ForeignKey(null=True, related_name='serverversion_by_first', blank=True, to='sync.Update'),
        ),
        migrations.AddField(
            model_name='serverversion',
            name='last_update',
            field=models.ForeignKey(null=True, related_name='serverversion_by_last', blank=True, to='sync.Update'),
        ),
        migrations.AddField(
            model_name='localserver',
            name='first_update',
            field=models.ForeignKey(null=True, related_name='localserver_by_first', blank=True, to='sync.Update'),
        ),
        migrations.AddField(
            model_name='localserver',
            name='last_update',
            field=models.ForeignKey(null=True, related_name='localserver_by_last', blank=True, to='sync.Update'),
        ),
        migrations.AddField(
            model_name='clientversion',
            name='first_update',
            field=models.ForeignKey(null=True, related_name='clientversion_by_first', blank=True, to='sync.Update'),
        ),
        migrations.AddField(
            model_name='clientversion',
            name='last_update',
            field=models.ForeignKey(null=True, related_name='clientversion_by_last', blank=True, to='sync.Update'),
        ),
        migrations.AlterIndexTogether(
            name='serverversion',
            index_together=set([('name', 'version')]),
        ),
        migrations.AlterIndexTogether(
            name='clientversion',
            index_together=set([('name', 'version')]),
        ),
    ]
