-- Copyright 2026 Beacon Contributors -- SPDX-License-Identifier: AGPL-3.0-or-later -- What a claim says about where its observer reports: the host of its poll_url ('' when the firmware sends none) -- and whether its signature was checked. ALTER TABLE polling_claims ADD COLUMN IF NOT EXISTS poll_host text NOT NULL DEFAULT ''; ALTER TABLE polling_claims ADD COLUMN IF NOT EXISTS signed boolean NOT NULL DEFAULT false; -- Which check-mode settings the claim was taken as this server's own under, '' when none were in force. A server -- that starts checking drops the claims that were not placed under its current settings. ALTER TABLE polling_claims ADD COLUMN IF NOT EXISTS claim_policy text NOT NULL DEFAULT ''; -- Claims from observers this server does not manage (polling.foreign_claims: check). They are kept apart from -- polling_claims so no election, owners answer or request ever sees them. CREATE TABLE IF NOT EXISTS polling_foreign_claims ( observer_public_key bytea PRIMARY KEY CHECK (octet_length(observer_public_key) = 32), observer_id uuid NOT NULL REFERENCES observers(id) ON DELETE CASCADE, client text NOT NULL DEFAULT '', poll_host text NOT NULL DEFAULT '', signed boolean NOT NULL DEFAULT false, claimed_at timestamp with time zone NOT NULL, received_at timestamp with time zone NOT NULL ); CREATE INDEX IF NOT EXISTS idx_polling_foreign_claims_observer ON polling_foreign_claims USING btree (observer_id); CREATE TABLE IF NOT EXISTS polling_foreign_targets ( observer_public_key bytea NOT NULL REFERENCES polling_foreign_claims(observer_public_key) ON DELETE CASCADE, target_public_key bytea NOT NULL, state text NOT NULL DEFAULT '', misses smallint NOT NULL DEFAULT 0, PRIMARY KEY (observer_public_key, target_public_key) ); CREATE INDEX IF NOT EXISTS idx_polling_foreign_targets_target ON polling_foreign_targets USING btree (target_public_key); -- True for a reading taken by an observer this server does not manage, set when the reading is stored. ALTER TABLE repeater_readings ADD COLUMN IF NOT EXISTS foreign_source boolean NOT NULL DEFAULT false;