19 lines
743 B
MySQL
19 lines
743 B
MySQL
|
|
-- Structured, reversible ignore rules for Drift devices.
|
||
|
|
-- Existing drift_device_blacklist settings remain readable for compatibility.
|
||
|
|
CREATE TABLE IF NOT EXISTS drift_ignore_rules (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
source_id INTEGER REFERENCES drift_sources(id) ON DELETE CASCADE,
|
||
|
|
external_id VARCHAR(255) NOT NULL,
|
||
|
|
device_name VARCHAR(255),
|
||
|
|
reason VARCHAR(100),
|
||
|
|
ignored_by INTEGER,
|
||
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
||
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
UNIQUE (source_id, external_id)
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_drift_ignore_rules_active
|
||
|
|
ON drift_ignore_rules (source_id, external_id)
|
||
|
|
WHERE is_active = TRUE;
|