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 {
insert,
replace,
@ -460,6 +456,5 @@ export default {
fillParamList,
copyDatabase,
disableSlowQueryLogging,
rebuildIntegrationTestDatabase,
getDbConnection
rebuildIntegrationTestDatabase
};

View File

@ -67,20 +67,8 @@ async function initDbConnection() {
PRIMARY KEY (tmpID)
);`)
// Register SQLite search functions after database is ready
try {
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}`);
}
// Note: SQLite search functions are now initialized directly in sql.ts
// This ensures they're available before any queries run
dbReady.resolve();
}