2 years ago
#64945

Himawari_zou
gorm AutoMigrate() add new primaryKey not woring
type Passport struct {
Uid int64 `gorm:"primaryKey"`
...
}
i used
dbMain.Set("gorm:table_options", "CHARSET=utf8mb4").AutoMigrate(new(Passport))
to created a table;
type Passport struct {
Uid int64 `gorm:"primaryKey"`
Type int `gorm:"primaryKey"`
...
}
and then i changed my struct, wanna use AutoMigrate()
to build composite primary key;
but not working
btw gorm:"not null
is useful
go
go-gorm
0 Answers
Your Answer