# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2018-05-23 16:44
from __future__ import print_function
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django_elastic_migrations.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Index',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, unique=True, verbose_name='Index Name')),
            ],
        ),
        migrations.CreateModel(
            name='IndexAction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('action', models.CharField(choices=[('create_index', 'create_index'), ('activate_index', 'activate_index'), ('clear_index', 'clear_index'), ('update_index', 'update_index'), ('drop_index', 'drop_index'), ('deactivate_index', 'deactivate_index')], max_length=64)),
                ('start', models.DateTimeField(auto_now_add=True)),
                ('end', models.DateTimeField(blank=True, null=True)),
                ('last_modified', models.DateTimeField(auto_now=True)),
                ('status', models.CharField(choices=[('in_progress', 'in_progress'), ('complete', 'complete'), ('aborted', 'aborted'), ('queued', 'queued')], default='queued', max_length=32)),
                ('log', models.TextField(blank=True)),
                ('index', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_elastic_migrations.Index')),
            ],
        ),
        migrations.CreateModel(
            name='IndexVersion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('prefix', models.CharField(blank=True, max_length=32, verbose_name='Environment Prefix')),
                ('json', models.TextField(blank=True, verbose_name='Elasticsearch Index JSON')),
                ('json_md5', models.CharField(db_index=True, editable=False, max_length=32, verbose_name='Elasticsearch Index JSON hash')),
                ('tag', models.CharField(blank=True, max_length=64, verbose_name='Codebase Git Tag')),
                ('inserted', models.DateTimeField(auto_now_add=True)),
                ('deleted_time', models.DateTimeField(blank=True, null=True)),
                ('index', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_elastic_migrations.Index')),
            ],
            options={
                'get_latest_by': 'id',
            },
        ),
        migrations.AddField(
            model_name='indexaction',
            name='index_version',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='django_elastic_migrations.IndexVersion'),
        ),
        migrations.AddField(
            model_name='index',
            name='active_version',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='django_elastic_migrations.IndexVersion'),
        ),
        migrations.CreateModel(
            name='ActivateIndexAction',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('django_elastic_migrations.indexaction',),
        ),
        migrations.CreateModel(
            name='ClearIndexAction',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=(django_elastic_migrations.models.OlderModeMixin, 'django_elastic_migrations.indexaction'),
        ),
        migrations.CreateModel(
            name='CreateIndexAction',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('django_elastic_migrations.indexaction',),
        ),
        migrations.CreateModel(
            name='DeactivateIndexAction',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('django_elastic_migrations.indexaction',),
        ),
        migrations.CreateModel(
            name='DropIndexAction',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=(django_elastic_migrations.models.OlderModeMixin, 'django_elastic_migrations.indexaction'),
        ),
        migrations.CreateModel(
            name='UpdateIndexAction',
            fields=[
            ],
            options={
                'proxy': True,
            },
            bases=(django_elastic_migrations.models.NewerModeMixin, 'django_elastic_migrations.indexaction'),
        ),
    ]
