feat: 为多个模型的外键字段添加级联删除和其他约束

This commit is contained in:
2025-12-23 11:00:09 +08:00
parent 1a78c76d02
commit 96bf447426
15 changed files with 206 additions and 47 deletions

View File

@@ -25,7 +25,11 @@ class SourceLink(SQLModelBase, TableBaseMixin):
"""通过此链接的下载次数"""
# 外键
object_id: UUID = Field(foreign_key="object.id", index=True)
object_id: UUID = Field(
foreign_key="object.id",
index=True,
ondelete="CASCADE"
)
"""关联的对象UUID必须是文件类型"""
# 关系