fix(db): migrate.js honors BIFROST_DB_PATH
So production migrations hit the same SQLite file the running app uses (src/lib/db.ts), instead of a repo-local bifrost.db. Mirrors the pattern already in seed-production.js and seed-roadmap.js. Falls back to the dev db when unset. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
378ee989bb
commit
fab927884c
1 changed files with 3 additions and 1 deletions
|
|
@ -5,7 +5,9 @@ import { join, dirname } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
const dbPath = join(__dirname, '..', 'bifrost.db');
|
// Honor BIFROST_DB_PATH in production so migrations hit the same file the
|
||||||
|
// running app uses (see src/lib/db.ts). Falls back to the repo-local dev db.
|
||||||
|
const dbPath = process.env.BIFROST_DB_PATH ?? join(__dirname, '..', 'bifrost.db');
|
||||||
const migrationsDir = join(__dirname, '..', 'migrations');
|
const migrationsDir = join(__dirname, '..', 'migrations');
|
||||||
|
|
||||||
const db = new Database(dbPath);
|
const db = new Database(dbPath);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue