A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: Fix the uniquness constraint on tag name
MohamedBassem580b842f7835
diff --git a/packages/db/prisma/migrations/20240214011350_fix_tag_name_index/migration.sql b/packages/db/prisma/migrations/20240214011350_fix_tag_name_index/migration.sqlnew file mode 100644index 00000000..cbcd8821--- /dev/null+++ b/packages/db/prisma/migrations/20240214011350_fix_tag_name_index/migration.sql@@ -0,0 +1,11 @@+/*+ Warnings:++ - A unique constraint covering the columns `[userId,name]` on the table `BookmarkTags` will be added. If there are existing duplicate values, this will fail.++*/+-- DropIndex+DROP INDEX "BookmarkTags_name_key";++-- CreateIndex+CREATE UNIQUE INDEX "BookmarkTags_userId_name_key" ON "BookmarkTags"("userId", "name");diff --git a/packages/db/prisma/schema.prisma b/packages/db/prisma/schema.prismaindex e77297c6..8a681a0b 100644--- a/packages/db/prisma/schema.prisma+++ b/packages/db/prisma/schema.prisma@@ -102,8 +102,7 @@ model BookmarkedLink {model BookmarkTags {id String @id @default(cuid())- // TODO: Tags are unique per user not globally- name String @unique+ name StringcreatedAt DateTime @default(now())userId String@@ -111,6 +110,8 @@ model BookmarkTags {// Relationsuser User @relation(fields: [userId], references: [id], onDelete: Cascade)bookmarks TagsOnBookmarks[]++ @@unique([userId, name])}model TagsOnBookmarks {