mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 22:44:25 +01:00
fix(search): get rid of exporting dbConnection
This commit is contained in:
parent
b8aa7402d8
commit
942647ab9c
@ -389,10 +389,6 @@ function disableSlowQueryLogging<T>(cb: () => T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDbConnection(): DatabaseType {
|
|
||||||
return dbConnection;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
insert,
|
insert,
|
||||||
replace,
|
replace,
|
||||||
@ -460,6 +456,5 @@ export default {
|
|||||||
fillParamList,
|
fillParamList,
|
||||||
copyDatabase,
|
copyDatabase,
|
||||||
disableSlowQueryLogging,
|
disableSlowQueryLogging,
|
||||||
rebuildIntegrationTestDatabase,
|
rebuildIntegrationTestDatabase
|
||||||
getDbConnection
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -67,20 +67,8 @@ async function initDbConnection() {
|
|||||||
PRIMARY KEY (tmpID)
|
PRIMARY KEY (tmpID)
|
||||||
);`)
|
);`)
|
||||||
|
|
||||||
// Register SQLite search functions after database is ready
|
// Note: SQLite search functions are now initialized directly in sql.ts
|
||||||
try {
|
// This ensures they're available before any queries run
|
||||||
const { getSqliteFunctionsService } = await import("./search/sqlite_functions.js");
|
|
||||||
const functionsService = getSqliteFunctionsService();
|
|
||||||
const db = sql.getDbConnection();
|
|
||||||
|
|
||||||
if (functionsService.registerFunctions(db)) {
|
|
||||||
log.info("SQLite search functions registered successfully");
|
|
||||||
} else {
|
|
||||||
log.info("SQLite search functions registration skipped (already registered)");
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
log.error(`Failed to register SQLite search functions: ${error}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
dbReady.resolve();
|
dbReady.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user