# Generated by Django 5.2.6 on 2025-10-06 21:32

from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="TaskAttempt",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("block_number", models.PositiveIntegerField(db_index=True)),
                ("executable_path", models.CharField(max_length=255)),
                ("args_json", models.TextField(default="{}")),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("pending", "Pending"),
                            ("running", "Running"),
                            ("success", "Success"),
                            ("failed", "Failed"),
                        ],
                        default="pending",
                        max_length=20,
                    ),
                ),
                ("celery_task_id", models.CharField(blank=True, max_length=50, null=True)),
                ("execution_result", models.JSONField(null=True)),
                ("last_attempted_at", models.DateTimeField(blank=True, null=True)),
                ("attempt_count", models.PositiveIntegerField(default=0)),
                ("next_retry_at", models.DateTimeField(blank=True, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Task Attempt",
                "verbose_name_plural": "Task Attempts",
                "indexes": [
                    models.Index(fields=["status", "next_retry_at"], name="abstract_bl_status_c3786f_idx"),
                    models.Index(fields=["block_number", "executable_path"], name="abstract_bl_block_n_97b116_idx"),
                ],
                "constraints": [
                    models.UniqueConstraint(
                        fields=("block_number", "executable_path", "args_json"), name="unique_task_attempt"
                    )
                ],
            },
        ),
    ]
