diff --git a/app/database.py b/app/database.py index 5f0b4ea..88c3c86 100644 --- a/app/database.py +++ b/app/database.py @@ -69,6 +69,12 @@ class Database: conn.execute("ALTER TABLE read_status ADD COLUMN is_favorite INTEGER DEFAULT 0") logger.info("Migration: added read_status.is_favorite column") + # Add raw_packet column to channel_messages (raw resend support) + cm_columns = {r[1] for r in conn.execute("PRAGMA table_info(channel_messages)").fetchall()} + if 'raw_packet' not in cm_columns: + conn.execute("ALTER TABLE channel_messages ADD COLUMN raw_packet TEXT") + logger.info("Migration: added channel_messages.raw_packet column") + @contextmanager def _connect(self): """Yield a connection with auto-commit/rollback.""" diff --git a/app/schema.sql b/app/schema.sql index 8c7e7cc..8cec069 100644 --- a/app/schema.sql +++ b/app/schema.sql @@ -86,6 +86,7 @@ CREATE TABLE IF NOT EXISTS channel_messages ( snr REAL, path_len INTEGER, pkt_payload TEXT, -- for echo matching + raw_packet TEXT, -- full hex packet (header+codes+path_len+payload) for raw resend; NULL for received/legacy rows raw_json TEXT, -- original JSON line created_at TEXT NOT NULL DEFAULT (datetime('now')) );