tracksolid_timescale_grafan.../migrations/13_drop_dwh_gold.sql

24 lines
1.3 KiB
MySQL
Raw Normal View History

-- 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;