-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
backendBackend relatedBackend relatedbugSomething isn't workingSomething isn't workingpriority:highHigh priorityHigh priority
Description
Problem
The campaign_snapshots table has a column name mismatch causing snapshot storage to fail:
ERROR: column "campaign_pid" does not exist (SQLSTATE 42703)
Root cause:
- Model field:
CampaignPID string - GORM snake_case:
campaign_p_id(incorrect due toPID→p_id) - Expected:
campaign_pid
This is the same issue we had with the campaigns table PK (#24), but we forgot to fix it for the foreign key in campaign_snapshots.
Impact
- ❌ All snapshot inserts fail (5,614 errors on each crawl)
- ❌ Sparkline charts have no historical data
- ❌ Velocity calculations broken
Current State
From logs (2026-02-27 14:12 UTC):
- ✅ 5,614 campaigns upserted successfully
- ❌ 5,614 snapshot inserts failed with
campaign_piderror
Solution
Add idempotent migration in db.go:
- Rename
campaign_p_id→campaign_pidif exists - Update GORM tag:
gorm:"column:campaign_pid"
Related
- feat(#18): add POST /api/admin/backfill for historical deep crawl #24 - Original
campaigns.pidcolumn name fix - PR fix: GORM column name mismatch — Campaign.PID saves as p_id instead of pid #25 - Where we should have caught this
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backendBackend relatedBackend relatedbugSomething isn't workingSomething isn't workingpriority:highHigh priorityHigh priority