feat: alter document and paragraph status fields and update foreign key constraints

This commit is contained in:
CaptainB 2025-06-09 19:12:29 +08:00
parent 68201d3f87
commit 56dc0c89de
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,30 @@
# Generated by Django 5.2.1 on 2025-06-09 11:09
import django.db.models.deletion
import knowledge.models.knowledge
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('knowledge', '0003_knowledge_file_count_limit_alter_document_status_and_more'),
]
operations = [
migrations.AlterField(
model_name='document',
name='status',
field=models.CharField(default=knowledge.models.knowledge.Status.__str__, max_length=20, verbose_name='状态'),
),
migrations.AlterField(
model_name='paragraph',
name='status',
field=models.CharField(default=knowledge.models.knowledge.Status.__str__, max_length=20, verbose_name='状态'),
),
migrations.AlterField(
model_name='problemparagraphmapping',
name='document',
field=models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to='knowledge.document'),
),
]

View File

@ -195,7 +195,7 @@ class Problem(AppModelMixin):
class ProblemParagraphMapping(AppModelMixin):
id = models.UUIDField(primary_key=True, max_length=128, default=uuid.uuid7, editable=False, verbose_name="主键id")
knowledge = models.ForeignKey(Knowledge, on_delete=models.DO_NOTHING, db_constraint=False)
document = models.ForeignKey(Document, on_delete=models.DO_NOTHING)
document = models.ForeignKey(Document, on_delete=models.DO_NOTHING, db_constraint=False)
problem = models.ForeignKey(Problem, on_delete=models.DO_NOTHING, db_constraint=False)
paragraph = models.ForeignKey(Paragraph, on_delete=models.DO_NOTHING, db_constraint=False)