feat(perception): stabilize pre-capture methodology

This commit is contained in:
DCCONSTRUCTIONS
2026-07-28 17:47:06 +03:00
parent 1f20e0d7d9
commit d729abab31
65 changed files with 9698 additions and 152 deletions
@@ -0,0 +1,31 @@
#!/bin/sh
set -eu
export PGPASSWORD="${MISSIONCORE_DB_ADMIN_PASSWORD}"
psql \
--host timescale \
--username "${MISSIONCORE_DB_ADMIN_USER}" \
--dbname "${MISSIONCORE_DB_NAME}" \
--set ON_ERROR_STOP=1 \
--set database_name="${MISSIONCORE_DB_NAME}" \
--set ingest_password="${MISSIONCORE_DB_INGEST_PASSWORD}" <<'SQL'
DO $roles$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_roles WHERE rolname = 'missioncore_normalizer'
) THEN
CREATE ROLE missioncore_normalizer LOGIN;
END IF;
END
$roles$;
ALTER ROLE missioncore_normalizer PASSWORD :'ingest_password';
GRANT CONNECT ON DATABASE :"database_name" TO missioncore_normalizer;
GRANT USAGE ON SCHEMA public TO missioncore_normalizer;
GRANT SELECT, INSERT, UPDATE, DELETE ON contour_telemetry_samples
TO missioncore_normalizer;
DELETE FROM contour_telemetry_samples
WHERE observed_at < CURRENT_TIMESTAMP - INTERVAL '30 days';
SQL