server: rewrite skipped instances query in raw SQL #230
Loading…
Reference in a new issue
No description provided.
Delete branch "sql/skipped-instances"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a first foray into the territory of hand-writing SQL queries, since typeorm seems to add an absurd amount of aliases and other shenanigans that result in absurdly long queries.
@ -28,2 +29,2 @@
await Instances.createQueryBuilder('instance')
.where('instance.host in (:...hosts)', {
await db.query(
'SELECT host FROM instance WHERE ("isSuspended" OR "latestStatus" = 410 OR "lastCommunicatedAt" < $1::date) AND host = ANY(string_to_array($2, \',\'))',
This could use template literals instead to avoid having to escape single quotes.