Files
dobetternorge-tools/migrations/maindb/002_tool_feedback.sql
T
daveadmin 519bdbb6e5 feat(tools): owner feedback review surface + tool_feedback migration
Adds the missing migration for the tool_feedback table (dobetternorge_maindb)
that the in-result feedback widget writes to, repoints api/feedback.php to
dbnmDb() for consistency with the engine-config table, and adds an owner-only
dashboard (page + read API + nav) summarising ratings and notes by tool/engine.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-21 15:19:45 +02:00

27 lines
1.4 KiB
SQL

-- 002_tool_feedback.sql
-- Target DB: dobetternorge_maindb (the tools' operational DB, via dbnmDb()).
-- Run manually after a mysqldump backup. Idempotent (IF NOT EXISTS).
--
-- Per-tool thumbs up/down + optional "what was missed or wrong" note, captured by
-- the in-result feedback widget (assets/js/tools.js) via api/feedback.php.
-- Metadata + voluntary comment only — NO pasted case content (process-and-forget).
--
-- tool : tool slug the result came from (ask|summarize|redact|timeline|...)
-- rating : positive | negative
-- engine : the engine string that produced the result (best-effort, client-supplied)
-- missed_or_wrong : short optional free-text note (what the tool missed/got wrong)
-- session_id : PHP session id (coarse de-dupe / abuse signal), not a user identity
CREATE TABLE IF NOT EXISTS tool_feedback (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
session_id VARCHAR(40) DEFAULT NULL,
tool VARCHAR(30) NOT NULL,
rating ENUM('positive','negative') NOT NULL,
missed_or_wrong TEXT DEFAULT NULL,
engine VARCHAR(60) DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY idx_tool (tool),
KEY idx_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;