cherry-studio/src/main/data/db/schemas/preference.ts
fullex 190f7ba2e1 refactor(database-patterns): enhance schema guidelines and file organization
- Added new section on schema file organization, detailing principles and decision criteria for merging or separating table files.
- Updated file naming conventions for single and multi-table files, as well as helper utilities.
- Refactored import paths in various schema files to use the new `_columnHelpers` module instead of the deprecated `columnHelpers`.
- Removed obsolete `customSql.ts`, `columnHelpers.ts`, `messageFts.ts`, `tag.ts`, `entityTag.ts`, and other related files to streamline the codebase.

This refactor improves clarity in database schema management and aligns file organization with best practices.
2026-01-07 20:46:09 +08:00

15 lines
465 B
TypeScript

import { primaryKey, sqliteTable, text } from 'drizzle-orm/sqlite-core'
import { createUpdateTimestamps } from './_columnHelpers'
export const preferenceTable = sqliteTable(
'preference',
{
scope: text().notNull().default('default'), // scope is reserved for future use, now only 'default' is supported
key: text().notNull(),
value: text({ mode: 'json' }),
...createUpdateTimestamps
},
(t) => [primaryKey({ columns: [t.scope, t.key] })]
)