diff options
| author | MohamedBassem <me@mbassem.com> | 2025-08-03 08:57:04 -0700 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2025-08-03 08:58:22 -0700 |
| commit | 88c4035bc0c716ba03e10da760253da0aefe7b60 (patch) | |
| tree | d1a7798c705562a896ef045675e19583abdf9e59 /packages/db/schema.ts | |
| parent | 99653566f73187631d30cb52a66a982c455c1f9a (diff) | |
| download | karakeep-88c4035bc0c716ba03e10da760253da0aefe7b60.tar.zst | |
fix: Get rid of the userSetting table completely
Diffstat (limited to 'packages/db/schema.ts')
| -rw-r--r-- | packages/db/schema.ts | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 8edd1d83..d94d3963 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -38,11 +38,26 @@ export const users = sqliteTable("user", { password: text("password"), salt: text("salt").notNull().default(""), role: text("role", { enum: ["admin", "user"] }).default("user"), + + // Admin Only Settings bookmarkQuota: integer("bookmarkQuota"), storageQuota: integer("storageQuota"), browserCrawlingEnabled: integer("browserCrawlingEnabled", { mode: "boolean", }), + + // User Settings + bookmarkClickAction: text("bookmarkClickAction", { + enum: ["open_original_link", "expand_bookmark_preview"], + }) + .notNull() + .default("open_original_link"), + archiveDisplayBehaviour: text("archiveDisplayBehaviour", { + enum: ["show", "hide"], + }) + .notNull() + .default("show"), + timezone: text("timezone").default("UTC"), }); export const accounts = sqliteTable( @@ -554,24 +569,6 @@ export const ruleEngineActionsTable = sqliteTable( ], ); -export const userSettings = sqliteTable("userSettings", { - userId: text("userId") - .notNull() - .primaryKey() - .references(() => users.id, { onDelete: "cascade" }), - bookmarkClickAction: text("bookmarkClickAction", { - enum: ["open_original_link", "expand_bookmark_preview"], - }) - .notNull() - .default("open_original_link"), - archiveDisplayBehaviour: text("archiveDisplayBehaviour", { - enum: ["show", "hide"], - }) - .notNull() - .default("show"), - timezone: text("timezone").default("UTC"), -}); - export const invites = sqliteTable("invites", { id: text("id") .notNull() @@ -639,10 +636,6 @@ export const userRelations = relations(users, ({ many, one }) => ({ webhooks: many(webhooksTable), rules: many(ruleEngineRulesTable), invites: many(invites), - settings: one(userSettings, { - fields: [users.id], - references: [userSettings.userId], - }), subscription: one(subscriptions), })); @@ -779,13 +772,6 @@ export const rssFeedImportsTableRelations = relations( }), ); -export const userSettingsRelations = relations(userSettings, ({ one }) => ({ - user: one(users, { - fields: [userSettings.userId], - references: [users.id], - }), -})); - export const invitesRelations = relations(invites, ({ one }) => ({ invitedBy: one(users, { fields: [invites.invitedBy], |
