Init Commit
quality / commitlint (push) Skipped
CD / update-wiki (push) Failing after 7s
quality / changes (push) Successful in 4s
quality / docker-check (push) Skipped
quality / web (push) Failing after 38s
quality / api (push) Successful in 49s
CD / quality (push) Failing after 1m36s
CD / publish (push) Skipped
quality / commitlint (push) Skipped
CD / update-wiki (push) Failing after 7s
quality / changes (push) Successful in 4s
quality / docker-check (push) Skipped
quality / web (push) Failing after 38s
quality / api (push) Successful in 49s
CD / quality (push) Failing after 1m36s
CD / publish (push) Skipped
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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(),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user