Do AfterCreate/AfterUpdate calls happen inside transactions? #6256
Unanswered
geoff-maddock
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm storing a new instance of a model with a create call:
But since the model has a number of associations that aren't going to be hydrated, I'm adding a find inside of a AfterCreate on the model:
This works with the database structure I'm using in dev, however, in prod we have a proxy that directs reads and writes to different databases. So I want to make sure that the afterCreate will work in this case, and not try to read from the reads database.
Does gorm retain the same transaction for these calls?
Beta Was this translation helpful? Give feedback.
All reactions