refactor(db): port sleep/wake sweeper to sqlc (#81)

Tranche 7 — all 11 raw sites in sleeper.go. Adds sleep_enabled and
sleep_idle_minutes to schema.sql and three runtime.sql queries:
ListSleepCandidates, GetServiceDomainText, GetServiceStatusText. Status
writes reuse SetServiceStatus; the wake loader reuses
GetServiceRuntimeWithOwner (the projects join is FK-safe).

Also drops a dead port read in handleServiceSleep that was loaded but
never used.

TestRuntimeLiveInvariants now covers the sweep filter and both text
lookups on live Postgres.

Generated with [Devin](https://devin.ai)

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomáš DvořákandDevin authored and GitHub committed 2026-10-10 05:11:34 +02:00
1 parent 269e031761
commit 81a4ca28d8
7 files changed
+173 -91

No files matched your search

+2
View File
@@ -69,6 +69,8 @@ CREATE TABLE services (
static_dir VARCHAR(255) NOT NULL DEFAULT '',
node_id VARCHAR(255),
spread BOOLEAN NOT NULL DEFAULT false,
sleep_enabled BOOLEAN NOT NULL DEFAULT false,
sleep_idle_minutes INTEGER NOT NULL DEFAULT 15,
placement_tags JSONB NOT NULL DEFAULT '[]',
traefik_labels JSONB NOT NULL DEFAULT '{}'
);