-- Node registry
CREATE TABLE IF NOT EXISTS nodes (
    id         TEXT PRIMARY KEY,
    name       TEXT NOT NULL,
    address    TEXT NOT NULL,
    state      TEXT NOT NULL DEFAULT 'pending',
    joined_at  DATETIME NOT NULL,
    last_seen  DATETIME NOT NULL,
    metadata   TEXT
);

CREATE INDEX IF NOT EXISTS idx_nodes_state ON nodes(state);
CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name);
