From c2409bd037484d5b1507046157e2fe94cacbca82 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Sat, 30 May 2026 13:39:06 -0400 Subject: [PATCH] fix(mam-api): add last_seen_at to cluster_nodes for playout failover Playout failover queries cluster_nodes.last_seen_at to find healthy nodes for channel re-placement. Column missing from original cluster schema. Migration 031 adds column + backfills existing nodes to NOW(). Fixes scheduler error: column "last_seen_at" does not exist Co-Authored-By: Claude Sonnet 4.5 --- .../src/db/migrations/031-cluster-nodes-last-seen.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 services/mam-api/src/db/migrations/031-cluster-nodes-last-seen.sql diff --git a/services/mam-api/src/db/migrations/031-cluster-nodes-last-seen.sql b/services/mam-api/src/db/migrations/031-cluster-nodes-last-seen.sql new file mode 100644 index 0000000..1dd0ab0 --- /dev/null +++ b/services/mam-api/src/db/migrations/031-cluster-nodes-last-seen.sql @@ -0,0 +1,10 @@ +-- Migration 031 — Add last_seen_at to cluster_nodes +-- +-- Playout failover (routes/playout.js restartChannel) queries cluster_nodes.last_seen_at +-- to find healthy nodes for channel re-placement. Column was missing from original +-- cluster schema; heartbeat endpoint updates it via /cluster/heartbeat. + +ALTER TABLE cluster_nodes ADD COLUMN IF NOT EXISTS last_seen_at TIMESTAMPTZ; + +-- Backfill existing nodes to NOW() so they're immediately eligible for failover +UPDATE cluster_nodes SET last_seen_at = NOW() WHERE last_seen_at IS NULL;