Your Question
When using customized join tables with the SetupJoinTable function, when should that function be run? Should it only be run when doing an AutoMigration, or should it be run on every new DB connection before that connection is used?
The document you expected this should be explained
https://gorm.io/docs/many_to_many.html#Customize-JoinTable
Expected answer
Details on when to run the SetupJoinTable function.
Comment From: jinzhu
It should run when initialize the db, and run it once is enough.
Comment From: KyleKotowick
Sorry, not quite following. When I initialize the DB every time I start the application, or when I initialize the DB to do an automigration?
Comment From: jinzhu
"When I initialize the DB every time I start the application"
On Sat, Feb 27, 2021 at 1:04 AM Kyle Kotowick notifications@github.com wrote:
Sorry, not quite following. When I initialize the DB every time I start the application, or when I initialize the DB to do an automigration?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/go-gorm/gorm/issues/4124#issuecomment-786772010, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABVO2JJ6D2SHSXVU5JQH3TA7IDBANCNFSM4YHKJVPA .
-- Best regards
Jinzhu github.com/jinzhu
Comment From: Easylife-z
It should run when initialize the db, and run it once is enough.
how to use this in gen?