Skip to content

fix: GORM column name mismatch — Campaign.PID saves as p_id instead of pid#25

Merged
Jing-yilin merged 1 commit intodevelopfrom
fix/pid-column-name
Feb 27, 2026
Merged

fix: GORM column name mismatch — Campaign.PID saves as p_id instead of pid#25
Jing-yilin merged 1 commit intodevelopfrom
fix/pid-column-name

Conversation

@Jing-yilin
Copy link
Contributor

Problem

All nightly crawl upserts fail with:

ERROR: column "pid" does not exist (SQLSTATE 42703)

GORM v2 converts the field name PIDp_id (snake_case), but the DB column is pid and all OnConflict clauses reference "pid".

Fix

Add gorm:"column:pid" explicit tag to Campaign.PID so GORM uses the correct column name.

Impact

ScrapingBee is successfully fetching data (confirmed in logs) — campaigns are just not being written to the DB. This fix unblocks all inserts.

GORM v2 converts PID → p_id by default, but the DB column and all
upsert conflict clauses reference 'pid'. Adding gorm:"column:pid"
forces the correct column name, unblocking all campaign inserts.
@Jing-yilin Jing-yilin merged commit 49a97d1 into develop Feb 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant