fix(migrations): resolve version collisions and add schema repair for quota thresholds

This commit is contained in:
Markus Hartung
2026-05-16 01:08:37 +02:00
parent 79d03575ee
commit 8e5c1d9ead
3 changed files with 7 additions and 0 deletions

View File

@@ -520,6 +520,10 @@ function ensureProviderConnectionsColumns(db: SqliteDatabase) {
db.exec("ALTER TABLE provider_connections ADD COLUMN max_concurrent INTEGER");
console.log("[DB] Added provider_connections.max_concurrent column");
}
if (!columnNames.has("quota_window_thresholds_json")) {
db.exec("ALTER TABLE provider_connections ADD COLUMN quota_window_thresholds_json TEXT");
console.log("[DB] Added provider_connections.quota_window_thresholds_json column");
}
db.exec(
"CREATE INDEX IF NOT EXISTS idx_pc_max_concurrent ON provider_connections(provider, max_concurrent)"
);

View File

@@ -148,6 +148,9 @@ const LEGACY_VERSION_SLOT_MIGRATIONS = [
{ version: "031", name: "api_keys_expires" },
{ version: "032", name: "detailed_logs_warnings" },
{ version: "033", name: "provider_connections_block_extra_usage" },
{ version: "033", name: "add_batch_id_to_call_logs" },
{ version: "046", name: "remove_status_from_files" },
{ version: "051", name: "remove_status_from_files" },
] as const;
const SUPERSEDED_DUPLICATE_MIGRATIONS = [