tracksolid_timescale_grafan.../db_audit/checks/null_integrity.sql
David Kiania 20d3ddb841 feat: add db_audit health checks, runner, and scheduled Forgejo workflow
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 21:40:29 +03:00

30 lines
650 B
SQL

-- NULL integrity check across telemetry tables
SELECT
'position_history.imei_null' AS check_field,
COUNT(*) AS null_count
FROM tracksolid.position_history
WHERE imei IS NULL
UNION ALL
SELECT
'position_history.gps_time_null',
COUNT(*)
FROM tracksolid.position_history
WHERE gps_time IS NULL
UNION ALL
SELECT
'alarms.imei_null',
COUNT(*)
FROM tracksolid.alarms
WHERE imei IS NULL
UNION ALL
SELECT
'alarms.alarm_type_null',
COUNT(*)
FROM tracksolid.alarms
WHERE alarm_type IS NULL
UNION ALL
SELECT
'obd_readings.imei_null',
COUNT(*)
FROM tracksolid.obd_readings
WHERE imei IS NULL;