From f530bbb18bcbc6a9597a1d54e99b5b874befc0f8 Mon Sep 17 00:00:00 2001 From: Yilin Jing Date: Fri, 27 Feb 2026 19:56:06 +0800 Subject: [PATCH] fix: add explicit gorm column:pid tag to Campaign.PID field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- backend/internal/model/model.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/internal/model/model.go b/backend/internal/model/model.go index d94df79..3a0d532 100644 --- a/backend/internal/model/model.go +++ b/backend/internal/model/model.go @@ -8,7 +8,7 @@ import ( ) type Campaign struct { - PID string `gorm:"primaryKey" json:"pid"` + PID string `gorm:"column:pid;primaryKey" json:"pid"` Name string `gorm:"not null" json:"name"` Blurb string `json:"blurb"` PhotoURL string `json:"photo_url"`