Self-Referential Many2Many Table need an extra column
manalivaltix opened this issue · comments
Manali Holankar commented
Document Link
Hello,
I want to use a self-referential many2many table association. The problem is I want to add an extra column "accepted" = true or fals, in the join-table
type User struct {
gorm.Model
MutualFriends []*User gorm:"many2many:friendships;association_jointable_foreignkey:friend_id"
// accepted = true
Friends []*User gorm:"many2many:friendships;association_jointable_foreignkey:friend_id"
// accepeted = false
}
How do I capture this? I am wondering if I should stop using gorm "definitions" to define the join table, and just have a separate model for friendships?