feat(migrator): use DATA_DIR env var

This commit is contained in:
ItzCrazyKns
2025-10-06 10:13:34 +05:30
parent 46b9e41100
commit cf3cc4e638

View File

@@ -2,9 +2,12 @@ import Database from 'better-sqlite3';
import path from 'path';
import fs from 'fs';
const db = new Database(path.join(process.cwd(), 'data', 'db.sqlite'));
const DATA_DIR = process.env.DATA_DIR || process.cwd();
const dbPath = path.join(DATA_DIR, './data/db.sqlite');
const migrationsFolder = path.join(process.cwd(), 'drizzle');
const db = new Database(dbPath);
const migrationsFolder = path.join(DATA_DIR, 'drizzle');
db.exec(`
CREATE TABLE IF NOT EXISTS ran_migrations (