From 3fa37fa10eb91bd936cafa9322a7bf0ce80b4ff4 Mon Sep 17 00:00:00 2001 From: Adam French Date: Wed, 10 Dec 2025 05:23:18 +0000 Subject: [PATCH] bugfix --- backend/models/post.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/models/post.go b/backend/models/post.go index 3397ecd..3a0013a 100644 --- a/backend/models/post.go +++ b/backend/models/post.go @@ -6,6 +6,6 @@ type Post struct { gorm.Model // includes ID, CreatedAt, UpdatedAt, DeletedAt Title string `gorm:"not null" json:"title"` AuthorID uint `json:"-"` - Author User `gorm:"foreignKey:AuthorID;references:ID" json:"author"` + Author User `gorm:"foreignKey:AuthorID,constraint:OnUpdate:CASCADE,OnDelete:SET NULL" json:"author"` Content string `json:"content"` }