diff --git a/packages/backend/server/migrations/20231124091123_soft_delete_opt_blobs/migration.sql b/packages/backend/server/migrations/20231124091123_soft_delete_opt_blobs/migration.sql new file mode 100644 index 0000000000000..6e107ce0722b2 --- /dev/null +++ b/packages/backend/server/migrations/20231124091123_soft_delete_opt_blobs/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "optimized_blobs" ADD COLUMN "deleted_at" TIMESTAMPTZ(6); diff --git a/packages/backend/server/schema.prisma b/packages/backend/server/schema.prisma index a35a4187d20cd..640ad71c4a4a6 100644 --- a/packages/backend/server/schema.prisma +++ b/packages/backend/server/schema.prisma @@ -178,13 +178,15 @@ model Blob { } model OptimizedBlob { - id Int @id @default(autoincrement()) @db.Integer - hash String @db.VarChar - workspaceId String @map("workspace_id") @db.VarChar - params String @db.VarChar - blob Bytes @db.ByteA + id Int @id @default(autoincrement()) @db.Integer + hash String @db.VarChar + workspaceId String @map("workspace_id") @db.VarChar + params String @db.VarChar + blob Bytes @db.ByteA length BigInt - createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) + // not for keeping, but for snapshot history + deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6) @@unique([workspaceId, hash, params]) @@map("optimized_blobs")