mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-22 09:12:44 +00:00
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.
21 lines
559 B
TypeScript
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();
|
|
}
|