v_2.3
This commit is contained in:
+27
@@ -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);
|
||||
Reference in New Issue
Block a user