mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-12 00:49:14 +08:00
- 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.
15 lines
465 B
TypeScript
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] })]
|
|
)
|