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

@@ -50,7 +50,11 @@ class UserAuthn(SQLModelBase, TableBaseMixin):
"""用户自定义的凭证名称,便于识别"""
# 外键
user_id: UUID = Field(foreign_key="user.id", index=True)
user_id: UUID = Field(
foreign_key="user.id",
index=True,
ondelete="CASCADE"
)
"""所属用户UUID"""
# 关系