Foreign Key not getting created…
type User struct{
gorm.Model
FirstName string json:"firstName"
LastName string json:"lastName"
}
type Restaurant struct {
gorm.Model
Name string json:"name"
UserID uint json:"ownerId"
User User
}
// Function to create table in psql…
db.CreateTable(&models.User{},&models.Restaurant{})
But still when looking \dt restaurants or \dt users in psql shell there is no foreign key associated to the table…