fleettickets/migrations
david kiania 5f5d71d500 feat(crq): add CRQ ingestion via shared engine + thin inc/crq entrypoints
Split the INC-only loader into a dataset-agnostic engine (pipeline.py, renamed
from import_tickets.py) parameterized by a Dataset config, with thin per-type
entrypoints inc/import_inc.py and crq/import_crq.py. CRQ shares INC's identical
32-column source schema and CDC change stream, so the engine is fully shared.

- pipeline.py: Dataset config (name/table/prefixes/key_regex/post_apply); INC
  keeps the capture_history post-apply hook, CRQ has none yet. geocode_locations
  now unions tickets.crq (geocoding is cross-dataset: one gazetteer/budget).
- crq/import_crq.py: drains automations/crq/changes/ from isptickets into
  tickets.crq (data layer + map; SLA/dashboard/history deferred).
- migrations/13_crq_columns.sql: CRQ mirror of 03 — typed STORED generated
  columns + indexes on tickets.crq (reuses tickets.eat_ts()).
- Deployment: Dockerfile/run_ingest.sh run both via `python -m`; pyproject
  packages inc/crq. Docs (README, implementation, deployment-and-operations,
  n8n export ref, phase-1) updated for the split + the one-time CRQ seed runbook.

tickets.crq already exists (mig 01, LIKE tickets.inc) and is unioned into
reporting.fn_tickets_for_map + resolve_ticket_geoms, so CRQ appears on the
existing Tickets map once seeded. Verified locally: ruff-clean new files, engine
lists/parses both streams against live S3 (crq=52 files, inc unaffected).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:16:38 +03:00
..
01_tickets_schema.sql feat: fleettickets — INC/CRQ ticket ingestion, geocoding + read-schema 2026-06-11 20:13:50 +03:00
02_import_meta.sql feat: INC hourly-CSV ingestion (newest-file, ETag dedup, clean + archive) 2026-06-15 19:33:16 +03:00
03_inc_columns.sql fix: address valid findings from 20260618 bug report 2026-06-18 13:41:38 +03:00
04_inc_latlng.sql feat: populate inc latitude/longitude from geocoded geom (migration 04) 2026-06-15 23:26:39 +03:00
05_inc_geography.sql feat: add geography column + GiST index for routing (migration 05) 2026-06-15 23:33:45 +03:00
06_inc_mttr_minutes.sql feat: mttr -> minutes; drop constant alarm/auto flags (migration 06) 2026-06-15 23:51:28 +03:00
07_inc_drop_service_type.sql feat: drop constant service_type column (migration 07) 2026-06-15 23:54:43 +03:00
08_inc_open_sla_view.sql feat: tickets.inc_open_sla view + lowercase legacy region 2026-06-16 00:03:55 +03:00
09_inc_dashboard_fn.sql feat: reporting.fn_inc_dashboard — INC operations dashboard read-API (migration 09) 2026-06-16 01:10:18 +03:00
10_inc_history_capture.sql feat: history capture — closure_events + daily backlog snapshot (migration 10) 2026-06-16 01:19:23 +03:00
12_inc_dashboard_by_owner.sql feat(reporting): add closure-by-engineer analytics to fn_inc_dashboard (migration 12) 2026-06-18 17:53:32 +03:00
13_crq_columns.sql feat(crq): add CRQ ingestion via shared engine + thin inc/crq entrypoints 2026-06-25 23:16:38 +03:00