bmc_hub/migrations/118_eset_sync.sql
Christian 297a8ef2d6 feat: Implement ESET integration for hardware management
- Added ESET sync functionality to periodically fetch devices and incidents.
- Created new ESET service for API interactions, including authentication and data retrieval.
- Introduced new database tables for storing ESET incidents and hardware contacts.
- Updated hardware assets schema to include ESET-specific fields (UUID, specs, group).
- Developed frontend templates for ESET overview, import, and testing.
- Enhanced existing hardware creation form to auto-generate AnyDesk links.
- Added global logout functionality to clear user session data.
- Improved error handling and logging for ESET API interactions.
2026-02-11 13:23:32 +01:00

31 lines
1.1 KiB
SQL

-- ESET sync support: hardware contacts + incidents cache
CREATE TABLE IF NOT EXISTS hardware_contacts (
id SERIAL PRIMARY KEY,
hardware_id INT NOT NULL REFERENCES hardware_assets(id) ON DELETE CASCADE,
contact_id INT NOT NULL REFERENCES contacts(id) ON DELETE CASCADE,
role VARCHAR(50) DEFAULT 'primary',
source VARCHAR(50) DEFAULT 'eset',
created_at TIMESTAMP DEFAULT NOW(),
UNIQUE(hardware_id, contact_id)
);
CREATE INDEX IF NOT EXISTS idx_hardware_contacts_hardware ON hardware_contacts(hardware_id);
CREATE INDEX IF NOT EXISTS idx_hardware_contacts_contact ON hardware_contacts(contact_id);
CREATE TABLE IF NOT EXISTS eset_incidents (
id SERIAL PRIMARY KEY,
incident_uuid VARCHAR(100) UNIQUE,
severity VARCHAR(50),
status VARCHAR(50),
device_uuid VARCHAR(100),
detected_at TIMESTAMP,
last_seen TIMESTAMP,
payload JSONB,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_eset_incidents_severity ON eset_incidents(severity);
CREATE INDEX IF NOT EXISTS idx_eset_incidents_device ON eset_incidents(device_uuid);