Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

refactor(db): move migrate schema to fn

LoneRiflef86c2b183a20
diff --git a/server/src/db/index.ts b/server/src/db/index.ts
index d4fba2d3..89930754 100644
--- a/server/src/db/index.ts
+++ b/server/src/db/index.ts
@@ -33,6 +33,13 @@ export function initDb(dbPath?: string): Database.Database {
if (!isMemory) db.pragma('journal_mode = WAL');
db.pragma('foreign_keys = ON');
+ migrateDbSchema(db);
+
+ console.log(`Database initialized at ${resolvedPath}`);
+ return db;
+}
+
+function migrateDbSchema(db: Database.Database) {
createTables(db);
initEncryptionKey(db);
seedModels(db);
@@ -63,9 +70,6 @@ export function initDb(dbPath?: string): Database.Database {
applyModelPricing(db);
migrateEmbeddingsV1(db);
ensureUnifiedKey(db);
-
- console.log(`Database initialized at ${resolvedPath}`);
- return db;
}
function createTables(db: Database.Database) {