# Generated by Django 2.0.5 on 2018-05-16 17:28

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Task',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('label', models.CharField(max_length=100, unique=True)),
                ('previous', models.ManyToManyField(blank=True, related_name='previous_task', to='genomix_workflows.Task')),
            ],
            options={
                'verbose_name_plural': 'Tasks',
                'verbose_name': 'Task',
            },
        ),
        migrations.CreateModel(
            name='TaskInstance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('status', models.PositiveSmallIntegerField(choices=[(1, 'Pending'), (2, 'Complete'), (3, 'Hold'), (4, 'Skip')], default=1)),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='task_instances', to='genomix_workflows.Task')),
            ],
            options={
                'verbose_name_plural': 'Task Instances',
                'verbose_name': 'Task Instance',
            },
        ),
        migrations.CreateModel(
            name='Workflow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('version', models.FloatField(validators=[django.core.validators.MinValueValidator(0.0)])),
                ('label', models.CharField(max_length=100)),
                ('task', models.ManyToManyField(related_name='tasks', to='genomix_workflows.Task')),
            ],
            options={
                'verbose_name_plural': 'Workflows',
                'verbose_name': 'Workflow',
            },
        ),
        migrations.CreateModel(
            name='WorkflowInstance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('object_id', models.PositiveIntegerField(db_index=True)),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('workflow', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='workflow_instances', to='genomix_workflows.Workflow')),
            ],
            options={
                'verbose_name_plural': 'Workflow Instances',
                'verbose_name': 'Workflow Instance',
            },
        ),
        migrations.AddField(
            model_name='taskinstance',
            name='workflow_instance',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='task_instances', to='genomix_workflows.WorkflowInstance'),
        ),
        migrations.AlterUniqueTogether(
            name='taskinstance',
            unique_together={('task', 'workflow_instance')},
        ),
    ]
