change function and gorm tag

This commit is contained in:
Adrian Zürcher
2025-11-20 18:00:12 +01:00
parent 1d203d1d2f
commit f28a3edbcf
3 changed files with 12 additions and 6 deletions

View File

@@ -21,9 +21,9 @@ type Member struct {
FirstVisit string `gorm:"column:firstVisit" json:"firstVisit,omitempty"`
LastVisit string `gorm:"column:lastVisit" json:"lastVisit,omitempty"`
GroupId *int `json:"GroupId,omitempty"`
Group *Group `gorm:"foreignKey:GroupId" json:"group,omitempty"`
Group *Group `gorm:"foreignKey:GroupId;constraint:OnDelete:CASCADE;"json:"group,omitempty"`
ResponsibleId *int `json:"ResponsibleId,omitempty"`
Responsible *Member `gorm:"foreignKey:ResponsibleId" json:"responsible,omitempty"`
Responsible *Member `gorm:"foreignKey:ResponsibleId;constraint:OnDelete:CASCADE;" json:"responsible,omitempty"`
Comment string `gorm:"column:comment" json:"comment,omitempty"`
Events []*Event `gorm:"many2many:member_events;" `
}