Any chance we will get transaction block support in the future? It'd be helpful to input and store that information in Retool so it's clear for other developers to see how resource queries affect the backend.
Do you have any suggestions / alternatives for handling rollback?
I know I can use event handlers to trigger other queries (e.g., one resource query does a bulk update via primary key, then triggers on success a stored procedure in a different resource query), however I'd like to rollback a previous query in the event a downstream one fails.
Is there a JS query solution that would allow for this?
We don't have anything to natively support handling rollback, but you can always run a query to undo the action you just did On Failure of the query. Would something like that work for you?
@victoria is right, you would need to make a query to undo your earlier changes and that can all get pretty hairy if you are doing more than a couple queries.
What I do in those situations, and I realize this is not an option for everyone, is to create a stored procedure on the database to handle all of the queries.
I also wonder (never tried it) if you could disable converting queries to prepared statements and then run multiple SQL queries at a time all wrapped in a transaction block?
A tad risky maybe: make a special resource for doing such things and leave it on for your other queries.