# Generated by Django 5.0.6 on 2024-09-08 12:57

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Artifact',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=1024)),
                ('data', models.BinaryField(blank=True)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('md5sum', models.CharField(blank=True, editable=False, max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='PipelineDefinition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('event', models.CharField(max_length=256)),
                ('filters', models.JSONField(blank=True, default=dict, null=True)),
                ('options', models.JSONField(blank=True, default=dict, null=True)),
                ('enabled', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='TaskDefinition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('function', models.CharField(max_length=512, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Pipeline',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('node', models.CharField(default='undefined', max_length=256)),
                ('name', models.CharField(max_length=128)),
                ('status', models.IntegerField(choices=[(0, 'running'), (1, 'success'), (2, 'error'), (3, 'queued')], default=3)),
                ('tasks_count', models.IntegerField(default=0)),
                ('current_task', models.IntegerField(default=0)),
                ('start_ts', models.DateTimeField(auto_now_add=True)),
                ('end_ts', models.DateTimeField(blank=True, null=True)),
                ('user', models.ForeignKey(on_delete=models.SET(django_eventspipe.utils.get_sentinel_user), to=settings.AUTH_USER_MODEL)),
                ('definition', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='django_eventspipe.pipelinedefinition')),
            ],
        ),
        migrations.CreateModel(
            name='PipelineArtifact',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('artifact', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_eventspipe.artifact')),
                ('pipeline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_eventspipe.pipeline')),
            ],
        ),
        migrations.CreateModel(
            name='PipelineDefinitionTaskDefinition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('enabled', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=20)),
                ('pipeline_definition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_eventspipe.pipelinedefinition')),
                ('task_definition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_eventspipe.taskdefinition')),
            ],
        ),
        migrations.CreateModel(
            name='Task',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.IntegerField(choices=[(0, 'running'), (1, 'success'), (2, 'error'), (3, 'queued'), (4, 'skipped')], default=2)),
                ('node', models.CharField(default='undefined', max_length=256)),
                ('start_ts', models.DateTimeField(blank=True, null=True)),
                ('end_ts', models.DateTimeField(blank=True, null=True)),
                ('definition', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='django_eventspipe.pipelinedefinitiontaskdefinition')),
                ('pipeline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_eventspipe.pipeline')),
            ],
        ),
    ]
