mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 10:55:27 +00:00
feat(db): preserve agent sessions on asset deletion by setting onDelete to SetNull
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "agent_sessions" DROP CONSTRAINT "agent_sessions_asset_id_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "agent_sessions" ADD CONSTRAINT "agent_sessions_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -708,7 +708,7 @@ model AgentSession {
|
||||
cwd String
|
||||
leafId String? @map("leaf_id")
|
||||
assetId String? @map("asset_id")
|
||||
asset Asset? @relation("AssetToAgentSession", fields: [assetId], references: [id], onDelete: Cascade)
|
||||
asset Asset? @relation("AssetToAgentSession", fields: [assetId], references: [id], onDelete: SetNull)
|
||||
userCommentId String? @map("user_comment_id")
|
||||
type AgentSessionType @default(comment)
|
||||
name String?
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user