aboutsummaryrefslogtreecommitdiffstats
path: root/packages/db/schema.ts
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-10-06 14:33:40 +0000
committerMohamedBassem <me@mbassem.com>2024-10-06 15:51:45 +0000
commit1e5c575e16c8a9e6bd7592e83bea53af7f359e15 (patch)
treed706b7d0dad309e1c4e5ede15fcae8a5e2547c8a /packages/db/schema.ts
parentdb2d346cd6c265d8e7c69383c6de03bf5f6252f0 (diff)
downloadkarakeep-1e5c575e16c8a9e6bd7592e83bea53af7f359e15.tar.zst
refactor: Start tracking bookmark assets in the assets table
Diffstat (limited to 'packages/db/schema.ts')
-rw-r--r--packages/db/schema.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/db/schema.ts b/packages/db/schema.ts
index c11f3b92..6098feb1 100644
--- a/packages/db/schema.ts
+++ b/packages/db/schema.ts
@@ -164,6 +164,8 @@ export const enum AssetTypes {
LINK_BANNER_IMAGE = "linkBannerImage",
LINK_SCREENSHOT = "linkScreenshot",
LINK_FULL_PAGE_ARCHIVE = "linkFullPageArchive",
+ BOOKMARK_ASSET = "bookmarkAsset",
+ UNKNOWN = "unknown",
}
export const assets = sqliteTable(
@@ -176,11 +178,16 @@ export const assets = sqliteTable(
AssetTypes.LINK_BANNER_IMAGE,
AssetTypes.LINK_SCREENSHOT,
AssetTypes.LINK_FULL_PAGE_ARCHIVE,
+ AssetTypes.BOOKMARK_ASSET,
+ AssetTypes.UNKNOWN,
],
}).notNull(),
- bookmarkId: text("bookmarkId")
- .notNull()
- .references(() => bookmarks.id, { onDelete: "cascade" }),
+ size: integer("size").notNull().default(0),
+ contentType: text("contentType"),
+ fileName: text("fileName"),
+ bookmarkId: text("bookmarkId").references(() => bookmarks.id, {
+ onDelete: "cascade",
+ }),
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
@@ -302,7 +309,6 @@ export const bookmarksInLists = sqliteTable(
}),
);
-
export const customPrompts = sqliteTable(
"customPrompts",
{
@@ -312,7 +318,9 @@ export const customPrompts = sqliteTable(
.$defaultFn(() => createId()),
text: text("text").notNull(),
enabled: integer("enabled", { mode: "boolean" }).notNull(),
- appliesTo: text("attachedBy", { enum: ["all", "text", "images"] }).notNull(),
+ appliesTo: text("attachedBy", {
+ enum: ["all", "text", "images"],
+ }).notNull(),
createdAt: createdAtField(),
userId: text("userId")
.notNull()