0
我試圖創建一個使用gorm自我參照場:如何創建自引用關聯領域
type Post struct {
ID uint `gorm:"primary_key" json:"id"`
Post *Post `json:"post" xml:"post" sql:"default:null"`
}
db.AutoMigrate(&Post{})
列不在DB創建post_id
。嘗試了幾個結構字段名稱,沒有運氣。
哪個是正確的方式來處理自我refrenced協會?
謝謝。