Files
paseo/packages/server/scripts/db-query.ts
Mohamed Boudra 5d195e7e15 feat(storage): add SQLite persistence foundation
Begin the storage migration with a bootstrap-owned database and one-way legacy imports for schedules and push tokens. Legacy JSON remains untouched for downgrade compatibility while SQLite becomes the sole authority after first open.
2026-08-13 22:24:14 +02:00

21 lines
559 B
TypeScript

import { resolvePaseoHome } from "../src/server/paseo-home.js";
import { openDatabase } from "../src/server/db/open.js";
const sql = process.argv.slice(2).join(" ").trim();
if (!sql) {
throw new Error('Usage: npm run db:query -- "SELECT ..."');
}
const database = openDatabase(resolvePaseoHome());
try {
const statement = database.prepare(sql);
if (statement.columns().length > 0) {
console.table(statement.all());
} else {
const result = statement.run();
console.log(`changes: ${result.changes}`);
}
} finally {
database.close();
}