aboutsummaryrefslogtreecommitdiffstats
path: root/packages/db/schema.ts
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-12-27 16:09:29 +0000
committerMohamed Bassem <me@mbassem.com>2024-12-27 16:09:29 +0000
commit86d74e3f32dd5bccc8df195b55391e206df9a1c4 (patch)
tree0db92b5139f9ef0c8909c16db72fbef782b770b6 /packages/db/schema.ts
parenta23044bb74e01c861a92417c00d293ff86384e83 (diff)
downloadkarakeep-86d74e3f32dd5bccc8df195b55391e206df9a1c4.tar.zst
feat: Implement highlights support for links. Fixes #620
Diffstat (limited to 'packages/db/schema.ts')
-rw-r--r--packages/db/schema.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/db/schema.ts b/packages/db/schema.ts
index 8751db31..a8fe9eeb 100644
--- a/packages/db/schema.ts
+++ b/packages/db/schema.ts
@@ -204,6 +204,37 @@ export const assets = sqliteTable(
}),
);
+export const highlights = sqliteTable(
+ "highlights",
+ {
+ id: text("id")
+ .notNull()
+ .primaryKey()
+ .$defaultFn(() => createId()),
+ bookmarkId: text("bookmarkId")
+ .notNull()
+ .references(() => bookmarks.id, {
+ onDelete: "cascade",
+ }),
+ userId: text("userId")
+ .notNull()
+ .references(() => users.id, { onDelete: "cascade" }),
+ startOffset: integer("startOffset").notNull(),
+ endOffset: integer("endOffset").notNull(),
+ color: text("color", {
+ enum: ["red", "green", "blue", "yellow"],
+ }).default("yellow").notNull(),
+ text: text("text"),
+ note: text("note"),
+ createdAt: createdAtField(),
+ },
+
+ (tb) => ({
+ bookmarkIdIdx: index("highlights_bookmarkId_idx").on(tb.bookmarkId),
+ userIdIdx: index("highlights_userId_idx").on(tb.userId),
+ }),
+);
+
export const bookmarkTexts = sqliteTable("bookmarkTexts", {
id: text("id")
.notNull()