mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-21 21:56:46 +00:00
refactor: tighten sqlite migration queries
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user