# Generated by Django 5.2.14 on 2026-06-10 11:12 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("review_agent", "0008_knowledgebasedocument"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="RegulatoryInfoPackageArtifact", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "artifact_type", models.CharField( choices=[ ("template_copy", "模板副本"), ("instruction_extract", "说明书抽取结果"), ("field_extract_result", "字段抽取结果"), ("merged_fields", "合并字段"), ("generated_document", "生成文件"), ("traceability", "追溯清单"), ("zip_package", "ZIP包"), ("notification_record", "通知记录"), ], max_length=60, ), ), ( "file_format", models.CharField( choices=[ ("json", "JSON"), ("excel", "Excel"), ("docx", "DOCX"), ("doc", "DOC"), ("zip", "ZIP"), ("markdown", "Markdown"), ], max_length=20, ), ), ("name", models.CharField(max_length=160)), ("file_name", models.CharField(max_length=255)), ("storage_path", models.CharField(max_length=500)), ("file_size", models.BigIntegerField(default=0)), ( "content_hash", models.CharField(blank=True, default="", max_length=128), ), ("metadata", models.JSONField(blank=True, default=dict)), ( "created_by_node", models.CharField(blank=True, default="", max_length=60), ), ("created_at", models.DateTimeField(auto_now_add=True)), ("is_deleted", models.BooleanField(default=False)), ], options={ "db_table": "ra_regulatory_info_package_artifact", "ordering": ["-created_at", "-id"], }, ), migrations.CreateModel( name="RegulatoryInfoPackageBatch", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "source_summary_item_id", models.PositiveBigIntegerField(blank=True, null=True), ), ("batch_no", models.CharField(max_length=64, unique=True)), ( "status", models.CharField( choices=[ ("pending", "待执行"), ("running", "执行中"), ("waiting_user", "等待用户"), ("success", "成功"), ("partial_success", "部分成功"), ("failed", "失败"), ("cancelled", "已取消"), ], default="pending", max_length=30, ), ), ( "source_file_name", models.CharField(blank=True, default="", max_length=255), ), ( "source_storage_path", models.CharField(blank=True, default="", max_length=500), ), ( "product_name", models.CharField(blank=True, default="", max_length=200), ), ( "output_zip_name", models.CharField( blank=True, default="第1章 监管信息(预生成版).zip", max_length=255, ), ), ("generated_files", models.JSONField(blank=True, default=list)), ("missing_fields", models.JSONField(blank=True, default=list)), ("llm_only_fields", models.JSONField(blank=True, default=list)), ("conflict_fields", models.JSONField(blank=True, default=list)), ("risk_notes", models.JSONField(blank=True, default=list)), ( "template_config_version", models.CharField(blank=True, default="", max_length=80), ), ( "template_config_hash", models.CharField(blank=True, default="", max_length=128), ), ("adapter_summary", models.JSONField(blank=True, default=dict)), ("work_dir", models.CharField(blank=True, default="", max_length=500)), ("error_message", models.TextField(blank=True, default="")), ("created_at", models.DateTimeField(auto_now_add=True)), ("started_at", models.DateTimeField(blank=True, null=True)), ("finished_at", models.DateTimeField(blank=True, null=True)), ("archived_at", models.DateTimeField(blank=True, null=True)), ("is_deleted", models.BooleanField(default=False)), ], options={ "db_table": "ra_regulatory_info_package_batch", "ordering": ["-created_at", "-id"], }, ), migrations.CreateModel( name="RegulatoryInfoPackageNotificationRecord", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "channel", models.CharField( choices=[ ("feishu_cli", "飞书 CLI"), ("feishu_api", "飞书 API"), ("mock", "模拟"), ], default="mock", max_length=30, ), ), ("export_ids", models.JSONField(blank=True, default=list)), ("message_summary", models.TextField(blank=True, default="")), ( "send_status", models.CharField( choices=[ ("pending", "待发送"), ("success", "成功"), ("failed", "失败"), ], default="pending", max_length=20, ), ), ("retry_count", models.PositiveIntegerField(default=0)), ( "external_message_id", models.CharField(blank=True, default="", max_length=120), ), ("error_message", models.TextField(blank=True, default="")), ("sent_at", models.DateTimeField(blank=True, null=True)), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ("is_deleted", models.BooleanField(default=False)), ], options={ "db_table": "ra_regulatory_info_package_notification_record", "ordering": ["-created_at", "-id"], }, ), migrations.AlterField( model_name="exportedsummaryfile", name="batch", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name="exports", to="review_agent.filesummarybatch", ), ), migrations.AlterField( model_name="exportedsummaryfile", name="export_type", field=models.CharField( choices=[ ("markdown", "Markdown"), ("excel", "Excel"), ("json", "JSON"), ("word", "Word"), ("pdf", "PDF"), ("zip", "ZIP"), ], max_length=20, ), ), migrations.AddConstraint( model_name="workflownoderun", constraint=models.UniqueConstraint( fields=("workflow_type", "workflow_batch_id", "node_code"), name="uq_ra_node_workflow_batch_code", ), ), migrations.AddField( model_name="regulatoryinfopackagebatch", name="conversation", field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="regulatory_info_package_batches", to="review_agent.conversation", ), ), migrations.AddField( model_name="regulatoryinfopackagebatch", name="source_attachment", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="regulatory_info_package_batches", to="review_agent.fileattachment", ), ), migrations.AddField( model_name="regulatoryinfopackagebatch", name="source_summary_batch", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="regulatory_info_package_batches", to="review_agent.filesummarybatch", ), ), migrations.AddField( model_name="regulatoryinfopackagebatch", name="trigger_message", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="triggered_regulatory_info_package_batches", to="review_agent.message", ), ), migrations.AddField( model_name="regulatoryinfopackagebatch", name="user", field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="review_regulatory_info_package_batches", to=settings.AUTH_USER_MODEL, ), ), migrations.AddField( model_name="regulatoryinfopackageartifact", name="batch", field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="artifacts", to="review_agent.regulatoryinfopackagebatch", ), ), migrations.AddField( model_name="regulatoryinfopackagenotificationrecord", name="batch", field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="notifications", to="review_agent.regulatoryinfopackagebatch", ), ), migrations.AddField( model_name="regulatoryinfopackagenotificationrecord", name="recipient", field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="regulatory_info_package_notifications", to=settings.AUTH_USER_MODEL, ), ), migrations.AddIndex( model_name="regulatoryinfopackagebatch", index=models.Index( fields=["conversation", "status"], name="idx_ra_rip_batch_conv_status" ), ), migrations.AddIndex( model_name="regulatoryinfopackagebatch", index=models.Index( fields=["user", "created_at"], name="idx_ra_rip_batch_user_created" ), ), migrations.AddIndex( model_name="regulatoryinfopackagebatch", index=models.Index( fields=["source_attachment"], name="idx_ra_rip_batch_attachment" ), ), migrations.AddIndex( model_name="regulatoryinfopackagebatch", index=models.Index( fields=["source_summary_batch"], name="idx_ra_rip_batch_summary" ), ), migrations.AddIndex( model_name="regulatoryinfopackagebatch", index=models.Index(fields=["created_at"], name="idx_ra_rip_batch_created"), ), migrations.AddIndex( model_name="regulatoryinfopackageartifact", index=models.Index( fields=["batch", "artifact_type"], name="idx_ra_rip_artifact_batch_type" ), ), migrations.AddIndex( model_name="regulatoryinfopackageartifact", index=models.Index( fields=["file_format"], name="idx_ra_rip_artifact_format" ), ), migrations.AddIndex( model_name="regulatoryinfopackageartifact", index=models.Index( fields=["created_at"], name="idx_ra_rip_artifact_created" ), ), migrations.AddIndex( model_name="regulatoryinfopackagenotificationrecord", index=models.Index( fields=["batch", "created_at"], name="idx_ra_rip_notify_batch" ), ), migrations.AddIndex( model_name="regulatoryinfopackagenotificationrecord", index=models.Index( fields=["recipient", "send_status"], name="idx_ra_rip_notify_recipient" ), ), migrations.AddIndex( model_name="regulatoryinfopackagenotificationrecord", index=models.Index( fields=["send_status", "retry_count"], name="idx_ra_rip_notify_status" ), ), ]