type Contact struct {
gorm.Model
PersonID sql.NullInt64
}
type Person struct {
gorm.Model
}
I am trying to use gorm with mysql in the previuos code but I have the following problem:
I want:
- Use
sql.NullInt64to work easily with null values. - Use the base model definition
gorm.Model, including fieldsID,CreatedAt,UpdatedAt,DeletedAt. - Add a constraint
Db.Model(&models.Contact{}).AddForeignKey.
My problem:
Person.IDbecome"int(10)"in mysql.Contact.PersonIDbecome"bigint(20)"- MySql need the same type for pk and fk.
Some body can help me to solve this?