mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 04:14:30 +00:00
fix(asset): remove dangerous cascades that orphan s3 files
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_parent_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_project_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_target_id_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "assets"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_target_id_fkey" FOREIGN KEY ("target_id") REFERENCES "assets"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -363,11 +363,11 @@ model Asset {
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
parentId String? @map("parent_id")
|
||||
parent Asset? @relation("AssetChildren", fields: [parentId], references: [id], onDelete: Cascade)
|
||||
parent Asset? @relation("AssetChildren", fields: [parentId], references: [id])
|
||||
children Asset[] @relation("AssetChildren")
|
||||
|
||||
targetId String? @map("target_id")
|
||||
target Asset? @relation("SymlinkTarget", fields: [targetId], references: [id], onDelete: Cascade)
|
||||
target Asset? @relation("SymlinkTarget", fields: [targetId], references: [id])
|
||||
symlinks Asset[] @relation("SymlinkTarget")
|
||||
|
||||
metadataValues AssetMetadataValue[] @relation("AssetToMetadataValues")
|
||||
@@ -379,7 +379,7 @@ model Asset {
|
||||
task Task? @relation("TaskToAsset", fields: [taskId], references: [id])
|
||||
|
||||
projectId String? @map("project_id")
|
||||
project Project? @relation("ProjectToAsset", fields: [projectId], references: [id], onDelete: Cascade)
|
||||
project Project? @relation("ProjectToAsset", fields: [projectId], references: [id])
|
||||
|
||||
comments AssetComment[] @relation("AssetToComment")
|
||||
commentAttachments AssetCommentAttachment[] @relation("AssetToCommentAttachment")
|
||||
|
||||
Reference in New Issue
Block a user