refactor: tighten sqlite migration queries

This commit is contained in:
Peter Steinberger
2026-05-09 00:41:11 +01:00
parent 6a55ea28ad
commit 623794fa9a
2 changed files with 2 additions and 2 deletions

View File

@@ -49,7 +49,7 @@ export function executeCompiledSqliteQuerySync<Row>(
export function executeSqliteQuerySync<Row>(
db: DatabaseSync,
query: CompilableQuery,
query: CompilableQuery<Row>,
): QueryResult<Row> {
return executeCompiledSqliteQuerySync<Row>(db, query.compile());
}

View File

@@ -1923,7 +1923,7 @@ function countGlobalAgentOwnedSqliteRows(params: {
const kysely = getNodeSqliteKysely<LegacyGlobalAgentOwnedMigrationDatabase>(db);
const row = executeCompiledSqliteQuerySync<SqliteCountRow>(
db,
sql`SELECT COUNT(*) AS count FROM ${sql.raw(params.table)}`.compile(kysely),
sql`SELECT COUNT(*) AS count FROM ${sql.id(params.table)}`.compile(kysely),
).rows[0];
return typeof row?.count === "bigint" ? Number(row.count) : row?.count;
} catch {