How do I get the values of an insert inside a transaction?
I have this transaction where I create a project and add variables and a history of those variables. I need the IDs of the variables for
variables_history
. How can I get those values?
6 Replies
Where is
projectId
defined?Outside of the transaction
I guess I can do this but idk if this is what is usually done in these situations
insert
returns insertId
, try logging that out. It works for serial
type, but not sure if it works for uuids
I'm assuming projects
items have their projectId
already generated?Yeah these projects are coming from an API with an
id
which is the projectId
. Is serial
just an incremental ID or a random number?0 increment by 1
ur
getProjectVariables
is broken if it's returning empty after you insert
into your projects table
assuming the records were successfully inserted, you should have gotten data backHmm it works for the frontend... just not in the transaction.