tracksolid_timescale_grafan.../migrations/13_drop_dwh_gold.sql
david kiania 8c5a43f3b8
Some checks are pending
Static Analysis / static (push) Waiting to run
Tests / test (push) Waiting to run
chore(db): purge unused ops + dwh_gold schemas
Drop the dormant ops (workshop / tickets / dispatch / SLA / odometer)
and dwh_gold (nightly ETL aggregates) schemas plus their dependents —
features never implemented, no live writer or scheduled refresh.

- Prod DB (already applied): DROP SCHEMA ops/dwh_gold CASCADE, plus
  tracksolid.dispatch_log, v_sla_inflight, v_utilisation_daily.
- migrations/12_drop_ops.sql + 13_drop_dwh_gold.sql (forward, all
  IF EXISTS) registered in run_migrations.py for rebuild durability.
- grafana: removed 8 now-broken panels (In-flight SLA, Idle Cost,
  Utilisation Heatmap, Row 7 Field-Service SLAs) from daily_operations;
  panel count 21 -> 13.
- docs: scrubbed CLAUDE.md, PLATFORM_OVERVIEW.html (-19KB), DATA_FLOW.md;
  pre-drop seed snapshot in docs/reports/260605_ops_purge_backup.md.

The separate tracksolid_dwh server (31.97.44.246:5888) is unrelated
and untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 18:11:03 +03:00

23 lines
1.3 KiB
SQL

-- 13_drop_dwh_gold.sql
-- Purge the dormant `dwh_gold` aggregate schema and its dependent view. The nightly
-- ETL (dwh_gold.refresh_daily_metrics) was never scheduled, both fact/dim tables were
-- empty, and nothing in the live map/dashboard pipeline reads them. These analytics
-- may take a different direction later.
--
-- Created by migrations 02 (schema), 05 (dwh_gold expansion + refresh_daily_metrics)
-- and 07 (tracksolid.v_utilisation_daily). Per the repo rule we do NOT rewrite those
-- applied migrations — this forward migration drops the objects instead. On a fresh
-- rebuild 02/05/07 create them, then this file removes them again.
--
-- Both tables were empty at drop time, so there is no data backup (cf. the ops purge,
-- which had seed rows — docs/reports/260605_ops_purge_backup.md). Companion to
-- 12_drop_ops.sql; together they retire the unused ops + dwh_gold analytics layers.
--
-- Every statement is IF EXISTS so the file is safe to re-apply.
-- View first: it reads dwh_gold.dim_vehicles + dwh_gold.fact_daily_fleet_metrics.
DROP VIEW IF EXISTS tracksolid.v_utilisation_daily;
-- The whole dwh_gold schema: dim_vehicles, fact_daily_fleet_metrics, the
-- dim_vehicles sequence/indexes, and the refresh_daily_metrics() function.
DROP SCHEMA IF EXISTS dwh_gold CASCADE;