aboutsummaryrefslogtreecommitdiffstats
path: root/packages/db/schema.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/db/schema.ts')
-rw-r--r--packages/db/schema.ts63
1 files changed, 35 insertions, 28 deletions
diff --git a/packages/db/schema.ts b/packages/db/schema.ts
index 3fd7897f..07f1686e 100644
--- a/packages/db/schema.ts
+++ b/packages/db/schema.ts
@@ -126,33 +126,37 @@ export const bookmarks = sqliteTable(
}),
);
-export const bookmarkLinks = sqliteTable("bookmarkLinks", {
- id: text("id")
- .notNull()
- .primaryKey()
- .$defaultFn(() => createId())
- .references(() => bookmarks.id, { onDelete: "cascade" }),
- url: text("url").notNull(),
+export const bookmarkLinks = sqliteTable(
+ "bookmarkLinks",
+ {
+ id: text("id")
+ .notNull()
+ .primaryKey()
+ .$defaultFn(() => createId())
+ .references(() => bookmarks.id, { onDelete: "cascade" }),
+ url: text("url").notNull(),
- // Crawled info
- title: text("title"),
- description: text("description"),
- imageUrl: text("imageUrl"),
- favicon: text("favicon"),
- content: text("content"),
- htmlContent: text("htmlContent"),
- screenshotAssetId: text("screenshotAssetId"),
- fullPageArchiveAssetId: text("fullPageArchiveAssetId"),
- imageAssetId: text("imageAssetId"),
- crawledAt: integer("crawledAt", { mode: "timestamp" }),
- crawlStatus: text("crawlStatus", {
- enum: ["pending", "failure", "success"],
- }).default("pending"),
-}, (bl) => {
- return {
- urlIdx: index("bookmarkLinks_url_idx").on(bl.url),
- };
-});
+ // Crawled info
+ title: text("title"),
+ description: text("description"),
+ imageUrl: text("imageUrl"),
+ favicon: text("favicon"),
+ content: text("content"),
+ htmlContent: text("htmlContent"),
+ screenshotAssetId: text("screenshotAssetId"),
+ fullPageArchiveAssetId: text("fullPageArchiveAssetId"),
+ imageAssetId: text("imageAssetId"),
+ crawledAt: integer("crawledAt", { mode: "timestamp" }),
+ crawlStatus: text("crawlStatus", {
+ enum: ["pending", "failure", "success"],
+ }).default("pending"),
+ },
+ (bl) => {
+ return {
+ urlIdx: index("bookmarkLinks_url_idx").on(bl.url),
+ };
+ },
+);
export const bookmarkTexts = sqliteTable("bookmarkTexts", {
id: text("id")
@@ -174,6 +178,7 @@ export const bookmarkAssets = sqliteTable("bookmarkAssets", {
content: text("content"),
metadata: text("metadata"),
fileName: text("fileName"),
+ sourceUrl: text("sourceUrl"),
});
export const bookmarkTags = sqliteTable(
@@ -231,8 +236,10 @@ export const bookmarkLists = sqliteTable(
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- parentId: text("parentId")
- .references((): AnySQLiteColumn => bookmarkLists.id, { onDelete: "set null" }),
+ parentId: text("parentId").references(
+ (): AnySQLiteColumn => bookmarkLists.id,
+ { onDelete: "set null" },
+ ),
},
(bl) => ({
userIdIdx: index("bookmarkLists_userId_idx").on(bl.userId),