Skip to content

Build your personal knowledge base with Trilium Notes

fix(standalone): database initialization slow

Elian Doran62d6ce08a084
diff --git a/packages/trilium-core/src/services/sql_init.ts b/packages/trilium-core/src/services/sql_init.ts
index 03f38e1618..703abc77f7 100644
--- a/packages/trilium-core/src/services/sql_init.ts
+++ b/packages/trilium-core/src/services/sql_init.ts
@@ -148,8 +148,6 @@ async function createInitialDatabase(skipDemoDb?: boolean) {
const log = getLog();
sql.transactional(() => {
log.info("Creating database schema ...");
-
- console.log("Got schema:", schema.substring(0, 100)); // Log the first 100 characters of the schema to verify it's loaded correctly
sql.executeScript(schema);
becca_loader.load();
@@ -182,7 +180,9 @@ async function createInitialDatabase(skipDemoDb?: boolean) {
// Check hidden subtree.
// This ensures the existence of system templates, for the demo content.
console.log("Checking hidden subtree at first start.");
- getContext().init(() => hidden_subtree.checkHiddenSubtree());
+ getContext().init(() => {
+ getSql().transactional(() => hidden_subtree.checkHiddenSubtree());
+ });
// Import demo content.
log.info("Importing demo content...");