# Generated by Django 2.0.1 on 2018-02-15 18:11

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='DiGraph',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32)),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Workflow graphs',
            },
        ),
        migrations.CreateModel(
            name='TaskEdge',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=32, null=True)),
            ],
            options={
                'verbose_name_plural': 'Dependencies',
            },
        ),
        migrations.CreateModel(
            name='TaskNode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32)),
                ('in_degree', models.IntegerField(editable=False, null=True)),
                ('out_degree', models.IntegerField(editable=False, null=True)),
                ('children', models.ManyToManyField(blank=True, related_name='_parents', through='api.TaskEdge', to='api.TaskNode')),
                ('graph', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='nodes', to='api.DiGraph')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Tasks',
            },
            bases=(models.Model, django_dag.models.NodeBase),
        ),
        migrations.AddField(
            model_name='taskedge',
            name='child',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tasknode_parent', to='api.TaskNode'),
        ),
        migrations.AddField(
            model_name='taskedge',
            name='graph',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='api.DiGraph'),
        ),
        migrations.AddField(
            model_name='taskedge',
            name='parent',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tasknode_child', to='api.TaskNode'),
        ),
    ]
