pgx kann INET-Typen (OID 869) nicht direkt in *string scannen. Migration 0028 konvertiert public_ip, internal_ip, mgmt_ip auf TEXT (USING ip::TEXT erhält bestehende Werte). Basis-Migrationen 0002 + 0020 auf TEXT umgestellt damit frische Installs keine INET anlegen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
1.2 KiB
SQL
36 lines
1.2 KiB
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
|
|
-- Cluster peers. Populated by edgeguard-ctl cluster-join. Used by:
|
|
-- * internal/proxy → resolve current PG primary URL (also via KeyDB)
|
|
-- * internal/aggregator → fan-out reads to peer APIs
|
|
-- * internal/unbound → generate eg.cluster local-zone records
|
|
-- * internal/firewall → open peer-internal ports per IP
|
|
--
|
|
-- id is a stable UUID (not BIGSERIAL) so a node keeps its identity
|
|
-- across re-joins / re-images. fqdn is the externally addressable
|
|
-- name; api_url is its 9443 endpoint via mTLS.
|
|
CREATE TABLE IF NOT EXISTS ha_nodes (
|
|
id TEXT PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
fqdn TEXT NOT NULL,
|
|
api_url TEXT NOT NULL,
|
|
public_ip TEXT,
|
|
internal_ip TEXT,
|
|
role TEXT NOT NULL DEFAULT 'peer',
|
|
last_seen TIMESTAMPTZ,
|
|
joined_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
CONSTRAINT ha_nodes_fqdn_unique UNIQUE (fqdn)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_ha_nodes_last_seen ON ha_nodes (last_seen DESC);
|
|
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
DROP TABLE IF EXISTS ha_nodes;
|
|
-- +goose StatementEnd
|