Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: add orderIndex

Marc Seitzaae0b5b716c7
diff --git a/prisma/migrations/20240809000000_add_dataroom_order_index/migration.sql b/prisma/migrations/20240809000000_add_dataroom_order_index/migration.sql
new file mode 100644
index 00000000..cef2980d
--- /dev/null
+++ b/prisma/migrations/20240809000000_add_dataroom_order_index/migration.sql
@@ -0,0 +1,12 @@
+-- AlterTable
+ALTER TABLE "DataroomDocument" ADD COLUMN "orderIndex" INTEGER;
+
+-- AlterTable
+ALTER TABLE "DataroomFolder" ADD COLUMN "orderIndex" INTEGER;
+
+-- CreateIndex
+CREATE INDEX "DataroomDocument_dataroomId_folderId_orderIndex_idx" ON "DataroomDocument"("dataroomId", "folderId", "orderIndex");
+
+-- CreateIndex
+CREATE INDEX "DataroomFolder_dataroomId_parentId_orderIndex_idx" ON "DataroomFolder"("dataroomId", "parentId", "orderIndex");
+
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 4648623f..71f45401 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -411,12 +411,14 @@ model DataroomDocument {
document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
folderId String?
folder DataroomFolder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
+ orderIndex Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([dataroomId, documentId])
@@index([folderId])
+ @@index([dataroomId, folderId, orderIndex])
}
model DataroomFolder {
@@ -429,12 +431,14 @@ model DataroomFolder {
parentFolder DataroomFolder? @relation("SubFolders", fields: [parentId], references: [id], onDelete: SetNull)
dataroomId String
dataroom Dataroom @relation(fields: [dataroomId], references: [id], onDelete: Cascade)
+ orderIndex Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([dataroomId, path])
@@index([parentId])
+ @@index([dataroomId, parentId, orderIndex])
}
model DataroomBrand {