Browse Source

refactor: adjust temporary working directory based on environment

Modify the temporary working directory path in the SQLite database configuration to dynamically set the current working directory based on the NODE_ENV variable. This change ensures that the application uses the correct path in both production and development environments.
feat/auth-access-control
npmrun 1 day ago
parent
commit
88fe8d25d7
  1. 4
      packages/drizzle-pkg/database/sqlite/db.ts

4
packages/drizzle-pkg/database/sqlite/db.ts

@ -6,7 +6,9 @@ if (process.env.NODE_ENV === 'production') {
import('drizzle-orm/better-sqlite3/migrator') import('drizzle-orm/better-sqlite3/migrator')
} }
const tempCwd = path.resolve(process.cwd(), 'packages/drizzle-pkg'); const tempCwd = process.env.NODE_ENV === 'production'
? path.resolve(process.cwd(), 'packages/drizzle-pkg')
: process.cwd();
let dbUrl = process.env.DATABASE_URL; let dbUrl = process.env.DATABASE_URL;
if (dbUrl && dbUrl.startsWith('file:')) { if (dbUrl && dbUrl.startsWith('file:')) {

Loading…
Cancel
Save