diff --git a/sql/ednc_tables.sql b/sql/ednc_tables.sql index abf2cb7..208728c 100644 --- a/sql/ednc_tables.sql +++ b/sql/ednc_tables.sql @@ -19,5 +19,21 @@ CREATE TABLE IF NOT EXISTS ednclogs ( INDEX idx_action (action) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- View for easy querying (includes hostname from machines) +CREATE OR REPLACE VIEW vw_ednclogs AS +SELECT + l.logid, + l.machineid, + m.hostname, + l.filename, + l.action, + l.bytes_removed, + l.version, + l.message, + l.created +FROM ednclogs l +INNER JOIN machines m ON l.machineid = m.machineid; + -- Verify DESCRIBE ednclogs; +SELECT 'View created: vw_ednclogs' AS status;