from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('api_v1', '0009_apiauditlog'),
    ]

    operations = [
        migrations.CreateModel(
            name='MDYPlateOrderStagingTiiaUploadFailure',
            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(db_index=True, verbose_name='任务日期')),
                ('mdy_rowid', models.CharField(db_index=True, max_length=64, verbose_name='明道云 RowID')),
                ('staging_id', models.PositiveBigIntegerField(blank=True, db_index=True, null=True, verbose_name='暂存表ID')),
                ('error', models.TextField(blank=True, verbose_name='错误摘要')),
                ('details', models.JSONField(blank=True, default=list, help_text='通常存储上传 service 返回的失败条目列表', 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': '开版暂存图片上传失败记录',
                'db_table': 'api_mdy_plate_order_staging_tiia_upload_failure',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddConstraint(
            model_name='mdyplateorderstagingtiiauploadfailure',
            constraint=models.UniqueConstraint(fields=('run_date', 'mdy_rowid'), name='uniq_mdy_po_staging_tiia_fail_run_date_rowid'),
        ),
    ]

