@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
sql 12 lines 660 Bytes
Raw
1 -- Teardown claims used to bump updated_at past the link's revoke or publish-only write, so a
2 -- failed deprovision now reads as an unfinished relink. Give those rows the updated_at the
3 -- current write rule would have left. Touches only withdrawn links' live tunnels; idempotent.
4 UPDATE "relay_managed_endpoint_allocations" AS a
5 SET "updated_at" = l."updated_at"
6 FROM "relay_environment_links" AS l
7 WHERE l."user_id" = a."user_id"
8 AND l."environment_id" = a."environment_id"
9 AND a."tunnel_id" IS NOT NULL
10 AND a."tunnel_released_at" IS NULL
11 AND (l."revoked_at" IS NOT NULL OR l."managed_tunnels_enabled" = false)
12 AND l."updated_at" < a."updated_at";