graph/db+sqldb: delete channels in batches

Use the new `SLICES` directive to add a DeleteChannels query which takes
a set of DB channel IDs. Then replace all our calls to DeleteChannel
with a paginated call to DeleteChannels.
This commit is contained in:
Elle Mouton
2025-07-18 11:47:25 +02:00
parent de6c030f29
commit ddc0e95eda
4 changed files with 69 additions and 33 deletions

View File

@@ -569,8 +569,9 @@ WHERE c.version = $1 AND c.id > $2
ORDER BY c.id
LIMIT $3;
-- name: DeleteChannel :exec
DELETE FROM graph_channels WHERE id = $1;
-- name: DeleteChannels :exec
DELETE FROM graph_channels
WHERE id IN (sqlc.slice('ids')/*SLICE:ids*/);
/* ─────────────────────────────────────────────
graph_channel_features table queries