15 lines
392 B
JavaScript
15 lines
392 B
JavaScript
/* Run migrations without starting the server.
|
|
Useful in a deploy script, before restarting the unit.
|
|
|
|
DB_PATH=/var/lib/ngu/ngu.db pnpm migrate
|
|
*/
|
|
|
|
import { openDatabase, migrate } from "./db.js";
|
|
|
|
const DB_PATH = process.env.DB_PATH ?? "./ngu.db";
|
|
|
|
const db = await openDatabase(DB_PATH);
|
|
const version = migrate(db);
|
|
db.close();
|
|
|
|
console.log(`${DB_PATH} is at schema v${version}`);
|