Add DDL-based DB init and bootstrap

Add bootstrap entrypoint and migrate DB schema setup to SQL files. Introduces bootstrap.js, many data/ddl/*.sql files, and a new runDDL() in modules/database.js (exports pool and runDDL). Remove legacy modules/databaseGlobals.js. Update repositories and code to use database.pool.query calls. Bump package version and set main to bootstrap.js. Clean up server.js to remove inline DB/cert init (now handled by bootstrap). Overall: refactor DB initialization to run ordered SQL DDL files and centralize startup logic.
This commit is contained in:
2026-09-06 23:52:25 +02:00
parent 93892197ad
commit 87407fe604
40 changed files with 405 additions and 485 deletions
-6
View File
@@ -3,22 +3,16 @@ const hpp = require("hpp")
const app = express()
const cors = require("cors")
const path = require("node:path")
const utils = require("./modules/utils")
const logger = require("./modules/logger")
const helmet = require("helmet")
const loader = require("./modules/loader")
const DefaultError = require("./errors/DefaultError")
const path2regex = require("path-to-regexp")
const databaseGlobals = require("./modules/databaseGlobals")
const certificates = require("./modules/certificatesManager")
const { ValidationError } = require("./errors/errors")
const routes = loader.getRecursiveFiles(path.join(__dirname, "routes"))
const schemas = loader.getRecursiveFiles(path.join(__dirname, "schemas"))
const schemaRegistry = {}
databaseGlobals.setupDatabase()
certificates.setupKeys()
app.use(hpp())
app.use(helmet({