feat: one-to-many, belongs-to
This commit is contained in:
@@ -28,6 +28,7 @@ type Writer struct {
|
||||
}
|
||||
|
||||
// One-to-many
|
||||
|
||||
type Comment struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
CommentatorId uint
|
||||
|
||||
@@ -30,8 +30,8 @@ type City struct {
|
||||
Kuzbass Kuzbass
|
||||
}
|
||||
|
||||
type Federation struct {
|
||||
Lands []Land `gorm:"constraint:OnDelete:CASCADE;"` // want "Expected references `Id` in model `Federation` for 1:M relation with model `Land`"
|
||||
type Federation struct { // want "Id field should be presented model \"Federation\""
|
||||
Lands []Land `gorm:"constraint:OnDelete:CASCADE;"`
|
||||
}
|
||||
|
||||
type Land struct {
|
||||
|
||||
Reference in New Issue
Block a user