fix: roles query failing due to composite primary key in GORM many2many
Some checks failed
CI / Build & Test (push) Failing after 32s
Some checks failed
CI / Build & Test (push) Failing after 32s
Add explicit foreignKey/references tags to Role.Permissions association so GORM uses only ID (not composite ID+TenantID) for the join table.
This commit is contained in:
parent
485ae9b329
commit
66ec9afe77
@ -11,7 +11,7 @@ type Role struct {
|
|||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
Permissions []Permission `json:"permissions,omitempty" gorm:"many2many:role_permissions;"`
|
Permissions []Permission `json:"permissions,omitempty" gorm:"many2many:role_permissions;foreignKey:ID;references:ID;joinForeignKey:RoleID;joinReferences:PermissionID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Role) TableName() string {
|
func (Role) TableName() string {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user