Fix otel_trace_summaries schema: explicit platform prefix + repair migration #2972

Merged
mfreeman451 merged 1 commit from refs/pull/2972/head into staging 2026-02-26 23:38:33 +00:00
mfreeman451 commented 2026-02-26 23:37:09 +00:00 (Migrated from github.com)
Owner

Imported from GitHub pull request.

Original GitHub pull request: #2923
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2923
Original created: 2026-02-26T23:37:09Z
Original updated: 2026-02-26T23:38:34Z
Original head: carverauto/serviceradar:bug/missing-field-trace-sum
Original base: staging
Original merged: 2026-02-26T23:38:33Z by @mfreeman451

Summary

  • Fix migration 20260210120000 to use explicit platform. schema prefix instead of relying on search_path, which caused the table to land in public on some deployments
  • Add idempotent repair migration 20260226230000 that handles all broken states:
    • Drops stale copies in public schema (table or materialized view)
    • Converts platform.otel_trace_summaries from materialized view to table if still a MV
    • Adds refreshed_at column if missing from existing table
    • Ensures indexes exist

Root cause: The CREATE TABLE IF NOT EXISTS otel_trace_summaries in the original migration had no schema prefix. Depending on the search_path at migration time, this could create the table in public instead of platform, which then triggered the startup migration's "public schema has ServiceRadar tables" guard.

Test plan

  • Docker compose stack starts cleanly with all 14 containers healthy
  • otel_trace_summaries table exists in platform schema with all 15 columns including refreshed_at
  • web-ng RefreshTraceSummariesWorker runs without errors
  • Repair migration is idempotent — safe to run on already-fixed databases

🤖 Generated with Claude Code

Imported from GitHub pull request. Original GitHub pull request: #2923 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/pull/2923 Original created: 2026-02-26T23:37:09Z Original updated: 2026-02-26T23:38:34Z Original head: carverauto/serviceradar:bug/missing-field-trace-sum Original base: staging Original merged: 2026-02-26T23:38:33Z by @mfreeman451 --- ## Summary - Fix migration `20260210120000` to use explicit `platform.` schema prefix instead of relying on `search_path`, which caused the table to land in `public` on some deployments - Add idempotent repair migration `20260226230000` that handles all broken states: - Drops stale copies in `public` schema (table or materialized view) - Converts `platform.otel_trace_summaries` from materialized view to table if still a MV - Adds `refreshed_at` column if missing from existing table - Ensures indexes exist **Root cause**: The `CREATE TABLE IF NOT EXISTS otel_trace_summaries` in the original migration had no schema prefix. Depending on the `search_path` at migration time, this could create the table in `public` instead of `platform`, which then triggered the startup migration's "public schema has ServiceRadar tables" guard. ## Test plan - [x] Docker compose stack starts cleanly with all 14 containers healthy - [x] `otel_trace_summaries` table exists in `platform` schema with all 15 columns including `refreshed_at` - [x] web-ng `RefreshTraceSummariesWorker` runs without errors - [x] Repair migration is idempotent — safe to run on already-fixed databases 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!2972
No description provided.