These are chat archives for jinzhu/gorm

11th
Jan 2016
Edward Bramanti
@jadengore
Jan 11 2016 00:19
When using Updates on a Model, how do you form a map[string]interface for a field in the Model that is a Many2Manyrelationship?
Edward Bramanti
@jadengore
Jan 11 2016 00:41
^I was able to figure this out, used Associations
Sorry for the dumb question :cry:
Edward Bramanti
@jadengore
Jan 11 2016 01:12
How do I add a foreign key constraint for a join table?
Jinzhu
@jinzhu
Jan 11 2016 05:51
@jadengore you have to write SQL to do that by yourself
Edward Bramanti
@jadengore
Jan 11 2016 05:52
You can't use AddForeignKey since the table is autogen'd?
@jinzhu
Jinzhu
@jinzhu
Jan 11 2016 05:55
@jadengore you are able to use it, like db.Table("user_languages").AddForeignKey("language_id", "languages(id)", "RESTRICT", "RESTRICT")
Edward Bramanti
@jadengore
Jan 11 2016 05:56
Ah I see, the join table must be manually defined tho
Makes sense
Thanks
Jinzhu
@jinzhu
Jan 11 2016 06:04
my pleasure