# Generated by Django 3.2.18 on 2023-03-28 12:53

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

from commands_ui import app_settings


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(app_settings.USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Job",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=256)),
                ("app_config_name", models.CharField(max_length=256)),
                ("output", models.TextField(blank=True)),
                ("arguments", models.JSONField(blank=True, null=True)),
                ("started_at", models.DateTimeField(blank=True, null=True)),
                ("finished_at", models.DateTimeField(blank=True, null=True)),
                ("cancelled_at", models.DateTimeField(blank=True, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("task_count", models.PositiveIntegerField(blank=True, null=True)),
                (
                    "task_error_count",
                    models.PositiveIntegerField(blank=True, null=True),
                ),
                (
                    "task_success_count",
                    models.PositiveIntegerField(blank=True, null=True),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="jobs",
                        to=app_settings.USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ("-created_at",),
            },
        ),
    ]
