bmc_hub/migrations/196_drift_customer_mappings.sql
Christian 8710f7f798 feat(drift): add Drift module with frontend and backend components
- Implemented the Drift module with a new FastAPI router and HTML templates for the frontend.
- Created database tables for drift sources, devices, events, event history, and customer mappings.
- Added functionality to manage and display drift events, including filtering and bulk mapping of monitors to customers.
- Introduced tests for the Drift module, covering various functionalities including event blacklisting and UISP connector configuration.
- Enhanced Telefoni service tests to ensure proper call termination handling.
2026-06-26 14:15:46 +02:00

19 lines
741 B
SQL

-- Drift: explicit monitor->customer mappings for Uptime Kuma events
CREATE TABLE IF NOT EXISTS drift_customer_mappings (
id SERIAL PRIMARY KEY,
source_id INTEGER REFERENCES drift_sources(id) ON DELETE CASCADE,
monitor_key VARCHAR(255),
monitor_name VARCHAR(255),
customer_id INTEGER NOT NULL REFERENCES customers(id) ON DELETE CASCADE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (source_id, monitor_key)
);
CREATE INDEX IF NOT EXISTS idx_drift_customer_mappings_source_id
ON drift_customer_mappings(source_id);
CREATE INDEX IF NOT EXISTS idx_drift_customer_mappings_customer_id
ON drift_customer_mappings(customer_id);