-- ============================================================================ -- eDNC Special Character Fix - Database Setup -- Run on PRODUCTION to create ednclogs table -- Created: 2025-12-12 -- ============================================================================ -- Create ednclogs table (uses machineid FK to machines table) CREATE TABLE IF NOT EXISTS ednclogs ( logid INT AUTO_INCREMENT PRIMARY KEY, machineid INT NOT NULL, filename VARCHAR(255) NOT NULL, action ENUM('cleaned', 'ok', 'failed', 'error', 'started', 'stopped') NOT NULL, bytes_removed INT DEFAULT 0, version VARCHAR(20), message VARCHAR(500), created DATETIME DEFAULT CURRENT_TIMESTAMP, INDEX idx_machineid (machineid), INDEX idx_created (created), 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;