tracksolid_timescale_grafan.../migrations/12_drop_ops.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

30 lines
1.5 KiB
SQL

-- 12_drop_ops.sql
-- Purge the dormant `ops` schema (workshop / tickets / dispatch / SLA / odometer)
-- and the dispatch/SLA artefacts that lived in `tracksolid`. These features were
-- never implemented and may take a different direction; the schema and views were
-- empty (or seed-only) and unused by the live map/dashboard pipeline.
--
-- Created by migrations 06 (ops schema + dispatch_log), 07 (v_sla_inflight) and
-- 08 (ops.cost_rates / ops.kpi_targets seed). Per the repo rule we do NOT rewrite
-- those applied migrations — this forward migration drops the objects instead. On
-- a fresh rebuild 06/07/08 create them, then this file removes them again.
--
-- Pre-drop snapshot of the only seeded tables: docs/reports/260605_ops_purge_backup.md
-- (the seed is also reproducible from 08_analytics_config.sql).
--
-- Every statement is IF EXISTS so the file is safe to re-apply.
--
-- NOTE: dwh_gold and tracksolid.v_utilisation_daily are intentionally NOT touched
-- here — that is a separate decision.
-- View first: it reads ops.tickets + tracksolid.dispatch_log, so it must go before
-- the objects it depends on (avoids an implicit CASCADE surprise).
DROP VIEW IF EXISTS tracksolid.v_sla_inflight;
-- The whole ops schema: tickets, service_log, odometer_readings, cost_rates,
-- kpi_targets, and the view vw_service_forecast. CASCADE clears intra-schema deps.
DROP SCHEMA IF EXISTS ops CASCADE;
-- Dispatch feature table — lived in the tracksolid schema, empty, only fed
-- v_sla_inflight (now dropped).
DROP TABLE IF EXISTS tracksolid.dispatch_log;