Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

database

Isaac3959a42a30f4
diff --git a/packages/prisma/migrations/20250530041916_add_dashboard_sections_for_users/migration.sql b/packages/prisma/migrations/20250530041916_add_dashboard_sections_for_users/migration.sql
new file mode 100644
index 00000000..346befaf
--- /dev/null
+++ b/packages/prisma/migrations/20250530041916_add_dashboard_sections_for_users/migration.sql
@@ -0,0 +1,32 @@
+/*
+ Warnings:
+
+ - You are about to drop the column `dashboardPinnedLinks` on the `User` table. All the data in the column will be lost.
+ - You are about to drop the column `dashboardRecentLinks` on the `User` table. All the data in the column will be lost.
+
+*/
+-- CreateEnum
+CREATE TYPE "DashboardSectionType" AS ENUM ('STATS', 'RECENT_LINKS', 'PINNED_LINKS', 'COLLECTION');
+
+-- AlterTable
+ALTER TABLE "User" DROP COLUMN "dashboardPinnedLinks",
+DROP COLUMN "dashboardRecentLinks";
+
+-- CreateTable
+CREATE TABLE "DashboardSection" (
+ "id" SERIAL NOT NULL,
+ "userId" INTEGER NOT NULL,
+ "type" "DashboardSectionType" NOT NULL,
+ "collectionId" INTEGER,
+ "order" INTEGER NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ CONSTRAINT "DashboardSection_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "DashboardSection_userId_order_key" ON "DashboardSection"("userId", "order");
+
+-- AddForeignKey
+ALTER TABLE "DashboardSection" ADD CONSTRAINT "DashboardSection_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma
index e30ddd9d..8082f054 100644
--- a/packages/prisma/schema.prisma
+++ b/packages/prisma/schema.prisma
@@ -53,8 +53,6 @@ model User {
aiTaggingMethod AiTaggingMethod @default(DISABLED)
aiPredefinedTags String[] @default([])
aiTagExistingLinks Boolean @default(false)
- dashboardRecentLinks Boolean @default(true)
- dashboardPinnedLinks Boolean @default(true)
preventDuplicateLinks Boolean @default(false)
archiveAsScreenshot Boolean @default(true)
archiveAsMonolith Boolean @default(true)
@@ -65,6 +63,7 @@ model User {
referredBy String?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
+ DashboardSection DashboardSection[]
}
enum AiTaggingMethod {
@@ -83,6 +82,13 @@ enum LinksRouteTo {
DETAILS
}
+enum DashboardSectionType {
+ STATS
+ RECENT_LINKS
+ PINNED_LINKS
+ COLLECTION
+}
+
model WhitelistedUser {
id Int @id @default(autoincrement())
username String @default("")
@@ -252,3 +258,16 @@ model Highlight {
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}
+
+model DashboardSection {
+ id Int @id @default(autoincrement())
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+ userId Int
+ type DashboardSectionType
+ collectionId Int?
+ order Int
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+
+ @@unique([userId, order])
+}