feat(observer): observer_brokers table and DB CRUD

New observer_brokers table (name/host/port/credentials/TLS flags) plus
Database CRUD mirroring the analyzers pattern. Groundwork for the MQTT
packet-capture observer; no behavior change yet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-07-14 08:15:55 +02:00
parent 529b114104
commit 038ab47190
2 changed files with 83 additions and 0 deletions
+16
View File
@@ -66,6 +66,22 @@ CREATE TABLE IF NOT EXISTS analyzers (
CREATE UNIQUE INDEX IF NOT EXISTS idx_analyzers_one_default
ON analyzers(is_default) WHERE is_default = 1;
-- Observer: MQTT brokers that receive captured mesh packets
-- (meshcore-packet-capture compatible publishing)
CREATE TABLE IF NOT EXISTS observer_brokers (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL UNIQUE,
host TEXT NOT NULL,
port INTEGER NOT NULL DEFAULT 1883,
username TEXT NOT NULL DEFAULT '',
password TEXT NOT NULL DEFAULT '', -- plaintext (single-user LAN app)
use_tls INTEGER NOT NULL DEFAULT 0,
tls_verify INTEGER NOT NULL DEFAULT 1, -- 0 = accept self-signed certs
is_disabled INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);
-- Per-channel region mapping (absent row = no override; firmware default applies)
CREATE TABLE IF NOT EXISTS channel_scopes (
channel_idx INTEGER PRIMARY KEY,