# Generated by Django 5.2.8 on 2026-01-16 19:00

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('printing', '0030_add_view_all_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='PlateOrderTiiaUploadFailure',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('run_date', models.DateField(help_text='以任务处理的日期为准（通常为“昨天”）', verbose_name='任务日期')),
                ('plate_order_id', models.PositiveBigIntegerField(db_index=True, help_text='PlateOrder.id（不使用外键，避免历史数据/删除带来的约束问题）', verbose_name='开版订单ID')),
                ('error', models.TextField(blank=True, default='', verbose_name='错误摘要')),
                ('details', models.JSONField(blank=True, default=list, help_text='通常存储 upload_plate_order_images_to_tencent_tiia 返回的失败条目列表', verbose_name='错误详情')),
                ('attempts', models.PositiveIntegerField(default=0, verbose_name='尝试次数')),
                ('last_attempt_at', models.DateTimeField(blank=True, null=True, verbose_name='最后尝试时间')),
            ],
            options={
                'verbose_name': '开版订单图片上传失败记录',
                'verbose_name_plural': '开版订单图片上传失败记录',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddConstraint(
            model_name='plateordertiiauploadfailure',
            constraint=models.UniqueConstraint(fields=('run_date', 'plate_order_id'), name='uniq_plateorder_tiia_fail_run_date_po'),
        ),
    ]

