Your Question
How to create a foreign key to constraint multiple columns ? As SQL:
CONSTRAINT "college" FOREIGN KEY ("collegeId", "collegeName") REFERENCES "college"."college" ("id", "name") ON DELETE RESTRICT ON UPDATE RESTRICT
Comment From: jinzhu
define multiple foreign keys with tag foreignKey, references
Comment From: ext2ed
I have try
gorm:"ForeignKey:(collegeId, collegeName)"
But this is not a correct statement
Comment From: jinzhu
https://gorm.io/docs/many_to_many.html#Composite-Foreign-Keys
Comment From: ext2ed
https://gorm.io/docs/many_to_many.html#Composite-Foreign-Keys
Thanks !