This commit is contained in:
jpmvaz
2026-09-13 20:10:17 +01:00
parent 9b5cc30fb4
commit b192fb3f17
482 changed files with 0 additions and 48205 deletions
+27
View File
@@ -0,0 +1,27 @@
'use strict';
/**
* Prepares the database: creates the schema and seeds the default email
* templates. It is safe to run repeatedly (and the Docker entrypoint runs it
* on every start).
*
* The first administrator is NOT created here — on first boot the site itself
* shows a setup wizard in the browser that asks for the admin account.
*/
require('dotenv').config();
const { db, init, migrate, DB_PATH, reportMissingEmails } = require('./db');
const { seedDefaults } = require('./lib/templates');
init();
migrate();
seedDefaults();
const users = db.prepare('SELECT COUNT(*) c FROM users').get().c;
reportMissingEmails();
console.log(`Database ready at ${DB_PATH}`);
if (users === 0) {
console.log('No users yet — open the site in a browser to create the administrator account.');
} else {
console.log(`${users} user account(s) already present.`);
}
process.exit(0);