diff --git a/internal/cluster/store.go b/internal/cluster/store.go index f288691..1555636 100644 --- a/internal/cluster/store.go +++ b/internal/cluster/store.go @@ -25,8 +25,15 @@ type Store struct { func NewStore(pool *pgxpool.Pool) *Store { return &Store{Pool: pool} } +// baseSelect MUSS spaltenweise zu scanNode passen. pg_role fehlte hier +// urspruenglich (Befund 2026-09-11): HANode.PGRole kam dadurch ueberall als +// leerer String an, wo Store.List/Get benutzt wird — /cluster/nodes, +// /cluster/status und damit auch die pg_role-Spalte der Cluster-Seite. +// UpsertSelf schreibt pg_role bewusst NICHT (ON CONFLICT laesst die Spalte +// unangetastet), liest sie aber im RETURNING mit — sonst passt die +// Scan-Reihenfolge nicht. const baseSelect = ` -SELECT id, name, fqdn, api_url, public_ip, internal_ip, mgmt_ip, role, +SELECT id, name, fqdn, api_url, public_ip, internal_ip, mgmt_ip, role, pg_role, version, config_hash, status, last_seen, joined_at, created_at, updated_at FROM ha_nodes @@ -90,7 +97,7 @@ ON CONFLICT (id) DO UPDATE SET last_seen = EXCLUDED.last_seen, updated_at = NOW() RETURNING id, name, fqdn, api_url, public_ip, internal_ip, mgmt_ip, - role, version, config_hash, status, + role, pg_role, version, config_hash, status, last_seen, joined_at, created_at, updated_at`, n.ID, n.Name, n.FQDN, n.APIURL, n.PublicIP, n.InternalIP, n.MgmtIP, @@ -181,7 +188,7 @@ func scanNode(row interface{ Scan(...any) error }) (*models.HANode, error) { if err := row.Scan( &n.ID, &n.Name, &n.FQDN, &n.APIURL, &n.PublicIP, &n.InternalIP, &n.MgmtIP, - &n.Role, &n.Version, &n.ConfigHash, &n.Status, + &n.Role, &n.PGRole, &n.Version, &n.ConfigHash, &n.Status, &n.LastSeen, &n.JoinedAt, &n.CreatedAt, &n.UpdatedAt, ); err != nil {