server: rewrite skipped instances query in raw SQL #230

Manually merged
Johann150 merged 2 commits from sql/skipped-instances into main 2022-11-18 21:04:25 +00:00
Owner

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.

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.
Johann150 added 1 commit 2022-11-09 23:39:41 +00:00
server: rewrite skipped instances query in raw SQL
Some checks failed
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
1c4967015c
norm reviewed 2022-11-17 18:47:31 +00:00
@ -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, \',\'))',
Owner

This could use template literals instead to avoid having to escape single quotes.

This could use template literals instead to avoid having to escape single quotes.
Johann150 marked this conversation as resolved
Johann150 added 1 commit 2022-11-17 20:27:23 +00:00
use backticks to avoid escaped quotes
Some checks failed
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
b174b8a087
norm approved these changes 2022-11-18 00:02:22 +00:00
Johann150 manually merged commit 4183c429e6 into main 2022-11-18 21:04:25 +00:00
Johann150 deleted branch sql/skipped-instances 2022-11-18 21:04:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
feature
fix
upkeep
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#230
No description provided.