# Generated by Django 4.2.11 on 2024-06-18 08:13

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


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Task",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=255)),
                ("code", models.CharField(max_length=255, blank=True, null=True)),
                (
                    "status",
                    models.IntegerField(
                        choices=[
                            (1, "Pending"),
                            (2, "Progress"),
                            (3, "Successful"),
                            (4, "Failed"),
                            (5, "Canceled"),
                        ],
                        default=1,
                    ),
                ),
                ("data", models.JSONField(blank=True, null=True)),
                ("action", models.CharField(max_length=255)),
                ("retry_after", models.DurationField(default=datetime.timedelta(0))),
            ],
        ),
        migrations.CreateModel(
            name="TaskLog",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("timestamp", models.DateTimeField(auto_now=True)),
                (
                    "status",
                    models.IntegerField(
                        choices=[
                            (1, "Pending"),
                            (2, "Progress"),
                            (3, "Successful"),
                            (4, "Failed"),
                            (5, "Canceled"),
                        ]
                    ),
                ),
                ("message", models.TextField(blank=True, null=True)),
                (
                    "task",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="logs",
                        to="task.task",
                    ),
                ),
            ],
        ),
    ]
