Added 1B, 2 and added bootstrap again for site
This commit is contained in:
parent
b8995b3a1b
commit
d1ce485572
37 changed files with 1842 additions and 89 deletions
31
scripts/db-verify-circuit-schema.js
Normal file
31
scripts/db-verify-circuit-schema.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
const Database = require("better-sqlite3");
|
||||
const path = require("node:path");
|
||||
|
||||
const dbPath = path.resolve("data", "leistungsbilanz.db");
|
||||
const db = new Database(dbPath, { readonly: true });
|
||||
|
||||
const requiredTables = [
|
||||
"circuit_sections",
|
||||
"circuits",
|
||||
"circuit_device_rows",
|
||||
"legacy_consumer_circuit_migrations",
|
||||
"legacy_consumer_migration_reports",
|
||||
];
|
||||
|
||||
const rows = db
|
||||
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN (?, ?, ?, ?, ?)")
|
||||
.all(...requiredTables);
|
||||
|
||||
const existing = new Set(rows.map((row) => row.name));
|
||||
const missing = requiredTables.filter((name) => !existing.has(name));
|
||||
|
||||
console.log("Database:", dbPath);
|
||||
console.log("Required tables:", requiredTables.join(", "));
|
||||
console.log("Existing tables:", [...existing].join(", ") || "(none)");
|
||||
|
||||
if (missing.length > 0) {
|
||||
console.error("Missing tables:", missing.join(", "));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("Circuit-first schema verification passed.");
|
||||
Loading…
Add table
Add a link
Reference in a new issue