scaffolder: Convert to prepared statements

This commit is contained in:
Johan Haals
2021-02-08 09:24:48 +01:00
parent 9afa2d24c6
commit 44da5d09c5
@@ -158,8 +158,11 @@ export class DatabaseTaskStore implements TaskStore {
'last_heartbeat_at',
'<=',
this.db.client.config.client === 'sqlite3'
? this.db.raw(`datetime('now', '-${Number(timeoutS)} seconds')`)
: this.db.raw(`dateadd('second', -${Number(timeoutS)}, now())`),
? this.db.raw(`datetime('now', ?)`, [`-${timeoutS} seconds`])
: this.db.raw(`dateadd('second', ?, ?)`, [
`-${timeoutS}`,
this.db.fn.now(),
]),
);
const tasks = rawRows.map(row => ({
taskId: row.id,