Files
Denozordec d11414666f
Build, Test, and Push CFDM Docker Image / test (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / build-and-push (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / create-release (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / update-wiki (push) Has been cancelled
Refactor project to transition from Rust backend to Node.js with Fastify; update Dockerfile and Docker configurations for new build process; enhance local development instructions in CONTRIBUTING.md; implement health checks in Docker Compose; update pnpm-lock.yaml with new dependencies for API and shared packages; revise README.md to reflect new stack and development setup.
2026-06-19 12:06:32 +07:00

39 lines
953 B
JavaScript

import Database from "better-sqlite3";
import { existsSync } from "node:fs";
const path = process.argv[2] ?? "../../data/app.db";
if (!existsSync(path)) {
console.log("missing:", path);
process.exit(1);
}
const db = new Database(path, { readonly: true });
const tables = db
.prepare("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name")
.all()
.map((t) => t.name);
console.log("path:", path);
console.log("tables:", tables.join(", "));
for (const t of [
"domains",
"groups",
"dns_records",
"services",
"_migrations",
]) {
if (!tables.includes(t)) continue;
console.log(t, db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c);
}
if (tables.includes("domains")) {
console.log(
"sample:",
db.prepare("SELECT id, zone_name FROM domains LIMIT 5").all(),
);
}
if (tables.includes("_migrations")) {
console.log(
"migrations:",
db.prepare("SELECT name FROM _migrations ORDER BY name").all(),
);
}