diff options
| author | MohamedBassem <me@mbassem.com> | 2024-02-07 21:05:57 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-02-07 21:05:57 +0000 |
| commit | 8970b3a5375ccfd9b41c8a08722a2fc6bbbe3af9 (patch) | |
| tree | 50e4665944d2fe620522688a10584e29bb0b9e37 /db | |
| parent | 3ec45e8bbb8285b17c703907d4c161b633663096 (diff) | |
| download | karakeep-8970b3a5375ccfd9b41c8a08722a2fc6bbbe3af9.tar.zst | |
[feature] Add openAI integration for extracting tags from articles
Diffstat (limited to 'db')
| -rw-r--r-- | db/index.ts | 4 | ||||
| -rw-r--r-- | db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql | 21 | ||||
| -rw-r--r-- | db/prisma/schema.prisma | 1 |
3 files changed, 24 insertions, 2 deletions
diff --git a/db/index.ts b/db/index.ts index dbf925f4..fa46ca1f 100644 --- a/db/index.ts +++ b/db/index.ts @@ -2,6 +2,8 @@ import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); -export { Prisma } from "@prisma/client"; +// For some weird reason accessing @prisma/client from any package is causing problems (specially in error handling). +// Re export them here instead. +export * from "@prisma/client"; export default prisma; diff --git a/db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql b/db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql new file mode 100644 index 00000000..78184041 --- /dev/null +++ b/db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql @@ -0,0 +1,21 @@ +/* + Warnings: + + - You are about to drop the column `bookmarkTagsId` on the `TagsOnLinks` table. All the data in the column will be lost. + +*/ +-- RedefineTables +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_TagsOnLinks" ( + "linkId" TEXT NOT NULL, + "tagId" TEXT NOT NULL, + "attachedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "TagsOnLinks_linkId_fkey" FOREIGN KEY ("linkId") REFERENCES "BookmarkedLink" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "TagsOnLinks_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "BookmarkTags" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_TagsOnLinks" ("attachedAt", "linkId", "tagId") SELECT "attachedAt", "linkId", "tagId" FROM "TagsOnLinks"; +DROP TABLE "TagsOnLinks"; +ALTER TABLE "new_TagsOnLinks" RENAME TO "TagsOnLinks"; +CREATE UNIQUE INDEX "TagsOnLinks_linkId_tagId_key" ON "TagsOnLinks"("linkId", "tagId"); +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON; diff --git a/db/prisma/schema.prisma b/db/prisma/schema.prisma index f5b83b66..0e6d080c 100644 --- a/db/prisma/schema.prisma +++ b/db/prisma/schema.prisma @@ -100,7 +100,6 @@ model TagsOnLinks { tagId String attachedAt DateTime @default(now()) - bookmarkTagsId String @@unique([linkId, tagId]) } |
