Files
CherryHQ-cherry-studio/migrations/sqlite-drizzle.config.ts
fullex 11be90175f fix(drizzle-config): exclude test files from schema glob
The previous glob `./src/main/data/db/schemas/*` matched the
`__tests__` directory, and drizzle-kit's `prepareFilenames` expands any
matched directory by reading its immediate files regardless of
extension. That pulled `_columnHelpers.test.ts` into the schema load
path, and its `import ... from 'vitest'` blew up because drizzle-kit
loads schemas via CJS `require()` (vitest is ESM-only).

Switch to a recursive pattern that also excludes `*.test.ts` by name,
so the config tolerates future subdirectory-organised schemas without
re-introducing the same class of bug.
2026-04-21 23:11:25 -07:00

9 lines
300 B
TypeScript

import { defineConfig } from 'drizzle-kit'
export default defineConfig({
out: './migrations/sqlite-drizzle',
// Recursive + exclude *.test.ts so drizzle-kit never loads vitest-dependent files.
schema: './src/main/data/db/schemas/**/!(*.test).ts',
dialect: 'sqlite',
casing: 'snake_case'
})