# Generated by Django 5.2.8 on 2026-03-20 00:00

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('api_v1', '0012_datasync_merchant'),
    ]

    operations = [
        migrations.CreateModel(
            name='PrintingExternalSyncFailure',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('run_date', models.DateField(db_index=True, verbose_name='任务日期')),
                ('external_record_id', models.PositiveBigIntegerField(db_index=True, verbose_name='外部记录ID')),
                ('external_order_id', models.CharField(blank=True, max_length=100, verbose_name='外部订单编号')),
                ('product_name', models.CharField(blank=True, max_length=200, verbose_name='外部产品名')),
                ('error', models.TextField(blank=True, verbose_name='错误摘要')),
                ('raw', models.JSONField(blank=True, default=dict, 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_printing_external_sync_failure',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddConstraint(
            model_name='printingexternalsyncfailure',
            constraint=models.UniqueConstraint(fields=('run_date', 'external_record_id'), name='uniq_printing_ext_sync_fail_run_date_record'),
        ),
        migrations.AlterField(
            model_name='datasync',
            name='table_name',
            field=models.CharField(choices=[('product', '产品'), ('customer', '客户'), ('plate_order', '开版（明道云）'), ('printing_external_record', '印染订单（外部 records）'), ('mdy_plate_order_staging_tiia_upload', '开版暂存-腾讯图库上传')], max_length=50, verbose_name='同步目标'),
        ),
    ]
