documented foreignkey
This commit is contained in:
parent
6b8f2fcab8
commit
e475d7c52b
10
README.md
10
README.md
@ -1111,6 +1111,16 @@ type Animal struct {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Associations on non-standard column names must be defined using `foreignkey` on the associated field:
|
||||||
|
|
||||||
|
```go
|
||||||
|
AnimalId int64 `gorm:"column:beast_id;primary_key"`
|
||||||
|
Birthday time.Time `gorm:"column:day_of_the_beast"`
|
||||||
|
Age int64 `gorm:"column:age_of_the_beast"`
|
||||||
|
OwnerID int64 `gorm:"column:owner"`
|
||||||
|
Owner Owner `gorm:"foreignkey:OwnerID"`
|
||||||
|
```
|
||||||
|
|
||||||
## Composite Primary Key
|
## Composite Primary Key
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
Loading…
x
Reference in New Issue
Block a user