I'm trying to create self-reference field using gorm:
type Post struct {
ID uint `gorm:"primary_key" json:"id"`
Post *Post `json:"post" xml:"post" sql:"default:null"`
}
db.AutoMigrate(&Post{})
Column post_id
is not created in DB. Tried several struct field names, no luck.
Which is the correct way to handle self-refrenced associations?
Thank you.