diff --git a/packages/db/package.json b/packages/db/package.json index e1229dc5..15b353d6 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -24,7 +24,7 @@ "@hoarder/tsconfig": "workspace:^0.1.0", "@tsconfig/node21": "^21.0.1", "@types/better-sqlite3": "^7.6.11", - "drizzle-kit": "^0.24.02" + "drizzle-kit": "^0.30.01" }, "eslintConfig": { "root": true, diff --git a/packages/db/schema.ts b/packages/db/schema.ts index a8fe9eeb..722d57cf 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -49,11 +49,11 @@ export const accounts = sqliteTable( id_token: text("id_token"), session_state: text("session_state"), }, - (account) => ({ - compoundKey: primaryKey({ + (account) => [ + primaryKey({ columns: [account.provider, account.providerAccountId], }), - }), + ], ); export const sessions = sqliteTable("session", { @@ -74,9 +74,7 @@ export const verificationTokens = sqliteTable( token: text("token").notNull(), expires: integer("expires", { mode: "timestamp_ms" }).notNull(), }, - (vt) => ({ - compoundKey: primaryKey({ columns: [vt.identifier, vt.token] }), - }), + (vt) => [primaryKey({ columns: [vt.identifier, vt.token] })], ); export const apiKeys = sqliteTable( @@ -94,9 +92,7 @@ export const apiKeys = sqliteTable( .notNull() .references(() => users.id, { onDelete: "cascade" }), }, - (ak) => ({ - unq: unique().on(ak.name, ak.userId), - }), + (ak) => [unique().on(ak.name, ak.userId)], ); export const bookmarks = sqliteTable( @@ -124,12 +120,12 @@ export const bookmarks = sqliteTable( enum: [BookmarkTypes.LINK, BookmarkTypes.TEXT, BookmarkTypes.ASSET], }).notNull(), }, - (b) => ({ - userIdIdx: index("bookmarks_userId_idx").on(b.userId), - archivedIdx: index("bookmarks_archived_idx").on(b.archived), - favIdx: index("bookmarks_favourited_idx").on(b.favourited), - createdAtIdx: index("bookmarks_createdAt_idx").on(b.createdAt), - }), + (b) => [ + index("bookmarks_userId_idx").on(b.userId), + index("bookmarks_archived_idx").on(b.archived), + index("bookmarks_favourited_idx").on(b.favourited), + index("bookmarks_createdAt_idx").on(b.createdAt), + ], ); export const bookmarkLinks = sqliteTable( @@ -155,11 +151,7 @@ export const bookmarkLinks = sqliteTable( }).default("pending"), crawlStatusCode: integer("crawlStatusCode").default(200), }, - (bl) => { - return { - urlIdx: index("bookmarkLinks_url_idx").on(bl.url), - }; - }, + (bl) => [index("bookmarkLinks_url_idx").on(bl.url)], ); export const enum AssetTypes { @@ -197,11 +189,11 @@ export const assets = sqliteTable( .references(() => users.id, { onDelete: "cascade" }), }, - (tb) => ({ - bookmarkIdIdx: index("assets_bookmarkId_idx").on(tb.bookmarkId), - assetTypeIdx: index("assets_assetType_idx").on(tb.assetType), - userIdIdx: index("assets_userId_idx").on(tb.userId), - }), + (tb) => [ + index("assets_bookmarkId_idx").on(tb.bookmarkId), + index("assets_assetType_idx").on(tb.assetType), + index("assets_userId_idx").on(tb.userId), + ], ); export const highlights = sqliteTable( @@ -223,16 +215,17 @@ export const highlights = sqliteTable( endOffset: integer("endOffset").notNull(), color: text("color", { enum: ["red", "green", "blue", "yellow"], - }).default("yellow").notNull(), + }) + .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), - }), + (tb) => [ + index("highlights_bookmarkId_idx").on(tb.bookmarkId), + index("highlights_userId_idx").on(tb.userId), + ], ); export const bookmarkTexts = sqliteTable("bookmarkTexts", { @@ -272,11 +265,11 @@ export const bookmarkTags = sqliteTable( .notNull() .references(() => users.id, { onDelete: "cascade" }), }, - (bt) => ({ - uniq: unique().on(bt.userId, bt.name), - nameIdx: index("bookmarkTags_name_idx").on(bt.name), - userIdIdx: index("bookmarkTags_userId_idx").on(bt.userId), - }), + (bt) => [ + unique().on(bt.userId, bt.name), + index("bookmarkTags_name_idx").on(bt.name), + index("bookmarkTags_userId_idx").on(bt.userId), + ], ); export const tagsOnBookmarks = sqliteTable( @@ -294,11 +287,11 @@ export const tagsOnBookmarks = sqliteTable( ), attachedBy: text("attachedBy", { enum: ["ai", "human"] }).notNull(), }, - (tb) => ({ - pk: primaryKey({ columns: [tb.bookmarkId, tb.tagId] }), - tagIdIdx: index("tagsOnBookmarks_tagId_idx").on(tb.tagId), - bookmarkIdIdx: index("tagsOnBookmarks_bookmarkId_idx").on(tb.bookmarkId), - }), + (tb) => [ + primaryKey({ columns: [tb.bookmarkId, tb.tagId] }), + index("tagsOnBookmarks_tagId_idx").on(tb.tagId), + index("tagsOnBookmarks_bookmarkId_idx").on(tb.bookmarkId), + ], ); export const bookmarkLists = sqliteTable( @@ -319,9 +312,7 @@ export const bookmarkLists = sqliteTable( { onDelete: "set null" }, ), }, - (bl) => ({ - userIdIdx: index("bookmarkLists_userId_idx").on(bl.userId), - }), + (bl) => [index("bookmarkLists_userId_idx").on(bl.userId)], ); export const bookmarksInLists = sqliteTable( @@ -337,11 +328,11 @@ export const bookmarksInLists = sqliteTable( () => new Date(), ), }, - (tb) => ({ - pk: primaryKey({ columns: [tb.bookmarkId, tb.listId] }), - bookmarkIdIdx: index("bookmarksInLists_bookmarkId_idx").on(tb.bookmarkId), - listIdIdx: index("bookmarksInLists_listId_idx").on(tb.listId), - }), + (tb) => [ + primaryKey({ columns: [tb.bookmarkId, tb.listId] }), + index("bookmarksInLists_bookmarkId_idx").on(tb.bookmarkId), + index("bookmarksInLists_listId_idx").on(tb.listId), + ], ); export const customPrompts = sqliteTable( @@ -361,9 +352,7 @@ export const customPrompts = sqliteTable( .notNull() .references(() => users.id, { onDelete: "cascade" }), }, - (bl) => ({ - userIdIdx: index("customPrompts_userId_idx").on(bl.userId), - }), + (bl) => [index("customPrompts_userId_idx").on(bl.userId)], ); export const rssFeedsTable = sqliteTable( @@ -384,9 +373,7 @@ export const rssFeedsTable = sqliteTable( .notNull() .references(() => users.id, { onDelete: "cascade" }), }, - (bl) => ({ - userIdIdx: index("rssFeeds_userId_idx").on(bl.userId), - }), + (bl) => [index("rssFeeds_userId_idx").on(bl.userId)], ); export const rssFeedImportsTable = sqliteTable( @@ -405,11 +392,11 @@ export const rssFeedImportsTable = sqliteTable( onDelete: "set null", }), }, - (bl) => ({ - feedIdIdx: index("rssFeedImports_feedIdIdx_idx").on(bl.rssFeedId), - entryIdIdx: index("rssFeedImports_entryIdIdx_idx").on(bl.entryId), - feedIdEntryIdUnique: unique().on(bl.rssFeedId, bl.entryId), - }), + (bl) => [ + index("rssFeedImports_feedIdIdx_idx").on(bl.rssFeedId), + index("rssFeedImports_entryIdIdx_idx").on(bl.entryId), + unique().on(bl.rssFeedId, bl.entryId), + ], ); export const config = sqliteTable("config", { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 934c93bb..a840bd89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -927,8 +927,8 @@ importers: specifier: ^7.6.11 version: 7.6.11 drizzle-kit: - specifier: ^0.24.02 - version: 0.24.2 + specifier: ^0.30.01 + version: 0.30.1 packages/e2e_tests: dependencies: @@ -2562,8 +2562,8 @@ packages: '@docusaurus/types': optional: true - '@drizzle-team/brocli@0.10.1': - resolution: {integrity: sha512-AHy0vjc+n/4w/8Mif+w86qpppHuF3AyXbcWW+R/W7GNA3F5/p2nuhlkCJaTXSLZheB4l1rtHzOfr9A7NwoR/Zg==} + '@drizzle-team/brocli@0.10.2': + resolution: {integrity: sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w==} '@egjs/hammerjs@2.0.17': resolution: {integrity: sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==} @@ -6803,8 +6803,8 @@ packages: resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} engines: {node: '>=12'} - drizzle-kit@0.24.2: - resolution: {integrity: sha512-nXOaTSFiuIaTMhS8WJC2d4EBeIcN9OSt2A2cyFbQYBAZbi7lRsVGJNqDpEwPqYfJz38yxbY/UtbvBBahBfnExQ==} + drizzle-kit@0.30.1: + resolution: {integrity: sha512-HmA/NeewvHywhJ2ENXD3KvOuM/+K2dGLJfxVfIHsGwaqKICJnS+Ke2L6UcSrSrtMJLJaT0Im1Qv4TFXfaZShyw==} hasBin: true drizzle-orm@0.33.0: @@ -13943,7 +13943,7 @@ snapshots: '@babel/core': 7.26.0 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 - debug: 4.3.7 + debug: 4.4.0 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -13955,7 +13955,7 @@ snapshots: '@babel/core': 7.26.0 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 - debug: 4.3.7 + debug: 4.4.0 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -15959,7 +15959,7 @@ snapshots: - webpack-cli dev: false - '@drizzle-team/brocli@0.10.1': + '@drizzle-team/brocli@0.10.2': dev: true '@egjs/hammerjs@2.0.17': @@ -16517,7 +16517,7 @@ snapshots: '@expo/image-utils': 0.6.3 '@expo/json-file': 9.0.0 '@react-native/normalize-colors': 0.76.3 - debug: 4.3.7 + debug: 4.4.0 fs-extra: 9.1.0 resolve-from: 5.0.0 semver: 7.6.3 @@ -19243,7 +19243,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3) '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.3.3) - debug: 4.3.7 + debug: 4.4.0 eslint: 8.57.0 ts-api-utils: 1.2.1(typescript@5.3.3) typescript: 5.3.3 @@ -19273,7 +19273,7 @@ snapshots: dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.7 + debug: 4.4.0 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -19288,7 +19288,7 @@ snapshots: dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.7 + debug: 4.4.0 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -19621,7 +19621,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.3.7 + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: false @@ -19629,7 +19629,7 @@ snapshots: agent-base@7.1.0: dependencies: - debug: 4.3.7 + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: false @@ -21322,7 +21322,6 @@ snapshots: debug@4.4.0: dependencies: ms: 2.1.3 - dev: true decamelize@1.2.0: dev: false @@ -21736,9 +21735,9 @@ snapshots: dotenv@16.4.5: dev: false - drizzle-kit@0.24.2: + drizzle-kit@0.30.1: dependencies: - '@drizzle-team/brocli': 0.10.1 + '@drizzle-team/brocli': 0.10.2 '@esbuild-kit/esm-loader': 2.6.5 esbuild: 0.19.12 esbuild-register: 3.5.0(esbuild@0.19.12) @@ -21950,7 +21949,7 @@ snapshots: esbuild-register@3.5.0(esbuild@0.19.12): dependencies: - debug: 4.3.7 + debug: 4.4.0 esbuild: 0.19.12 transitivePeerDependencies: - supports-color @@ -22766,7 +22765,7 @@ snapshots: extract-zip@2.0.1: dependencies: - debug: 4.3.7 + debug: 4.4.0 get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: @@ -23276,7 +23275,7 @@ snapshots: dependencies: basic-ftp: 5.0.4 data-uri-to-buffer: 6.0.2 - debug: 4.3.7 + debug: 4.4.0 fs-extra: 11.2.0 transitivePeerDependencies: - supports-color @@ -23856,7 +23855,7 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.3.7 + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: false @@ -23873,7 +23872,7 @@ snapshots: https-proxy-agent@7.0.5: dependencies: agent-base: 7.1.0 - debug: 4.3.7 + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: false @@ -25934,7 +25933,7 @@ snapshots: micromark@4.0.0: dependencies: '@types/debug': 4.1.12 - debug: 4.3.7 + debug: 4.4.0 decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.0 @@ -26779,7 +26778,7 @@ snapshots: dependencies: '@tootallnate/quickjs-emscripten': 0.23.0 agent-base: 7.1.0 - debug: 4.3.7 + debug: 4.4.0 get-uri: 6.0.3 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.4 @@ -27574,7 +27573,7 @@ snapshots: proxy-agent@6.4.0: dependencies: agent-base: 7.1.0 - debug: 4.3.7 + debug: 4.4.0 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.4 lru-cache: 7.18.3 @@ -27637,7 +27636,7 @@ snapshots: puppeteer-extra-plugin-user-data-dir@2.4.1(puppeteer-extra@3.3.6(puppeteer@22.3.0(typescript@5.3.3))): dependencies: - debug: 4.3.7 + debug: 4.4.0 fs-extra: 10.1.0 puppeteer-extra: 3.3.6(puppeteer@22.3.0(typescript@5.3.3)) puppeteer-extra-plugin: 3.2.3(puppeteer-extra@3.3.6(puppeteer@22.3.0(typescript@5.3.3))) @@ -29191,7 +29190,7 @@ snapshots: socks-proxy-agent@8.0.2: dependencies: agent-base: 7.1.0 - debug: 4.3.7 + debug: 4.4.0 socks: 2.8.1 transitivePeerDependencies: - supports-color @@ -29240,7 +29239,7 @@ snapshots: spdy-transport@3.0.0: dependencies: - debug: 4.3.7 + debug: 4.4.0 detect-node: 2.1.0 hpack.js: 2.1.6 obuf: 1.1.2 @@ -29252,7 +29251,7 @@ snapshots: spdy@4.0.2: dependencies: - debug: 4.3.7 + debug: 4.4.0 handle-thing: 2.0.1 http-deceiver: 1.2.7 select-hose: 2.0.0 @@ -29499,7 +29498,7 @@ snapshots: dependencies: component-emitter: 1.3.1 cookiejar: 2.1.4 - debug: 4.3.7 + debug: 4.4.0 fast-safe-stringify: 2.1.1 form-data: 4.0.0 formidable: 2.1.2 @@ -31071,4 +31070,4 @@ snapshots: use-sync-external-store: 1.2.0(react@18.3.1) dev: false - zwitch@2.0.4: {} \ No newline at end of file + zwitch@2.0.4: {}