-- Multi-cluster support: the user can keep several DX cluster nodes saved
-- and connect to them concurrently. The first enabled row (by sort_order)
-- is the "master" — commands typed in the UI are sent through it.
CREATE TABLE cluster_servers (
    id             INTEGER PRIMARY KEY AUTOINCREMENT,
    name           TEXT NOT NULL,                    -- "VE7CC", "F4BPO home", …
    host           TEXT NOT NULL,
    port           INTEGER NOT NULL DEFAULT 7300,
    login_override TEXT NOT NULL DEFAULT '',         -- empty = use active profile callsign
    password       TEXT NOT NULL DEFAULT '',         -- some nodes require one
    init_commands  TEXT NOT NULL DEFAULT '',         -- newline-separated, sent after login
    enabled        INTEGER NOT NULL DEFAULT 1,
    sort_order     INTEGER NOT NULL DEFAULT 0,
    created_at     TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
    updated_at     TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
);

CREATE INDEX idx_cluster_servers_enabled ON cluster_servers(enabled, sort_order);

-- UI options for the Cluster tab. Stored in settings (key/value) as
-- usual, no migration needed.
