fix(search): get rid of exporting dbConnection

This commit is contained in:
perf3ct 2025-11-04 14:47:46 -08:00
parent b8aa7402d8
commit 942647ab9c
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
2 changed files with 3 additions and 20 deletions

View File

@ -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
}; };

View File

@ -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();
} }