You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on automating audit logging for a Next.js application. I have a trigger function set up to run on insert/update/delete and the issue comes when trying to pass the application user's id (not the PostgreSQL user) to the trigger. I have got it working manually with the following code, but would like to be able to wrap all queries in the transaction to automate things a bit more.
Is there currently a middleware or other method to wrap the insert query above, adding the transaction and setting the app_session_user to all queries automatically so it can be accessed in the trigger function?
Or maybe I am thinking about this all wrong, if so, any suggestions on a better method would be appreciated.
The text was updated successfully, but these errors were encountered:
Environment
Knex version: Knex 3.0.1
Database + version: PostgreSQL 14.11
OS: Ubuntu
Feature discussion / request
I am working on automating audit logging for a Next.js application. I have a trigger function set up to run on insert/update/delete and the issue comes when trying to pass the application user's id (not the PostgreSQL user) to the trigger. I have got it working manually with the following code, but would like to be able to wrap all queries in the transaction to automate things a bit more.
Is there currently a middleware or other method to wrap the insert query above, adding the transaction and setting the app_session_user to all queries automatically so it can be accessed in the trigger function?
Or maybe I am thinking about this all wrong, if so, any suggestions on a better method would be appreciated.
The text was updated successfully, but these errors were encountered: