Transactions in DreamFactory


#1

Hello,

Is there a way to implement transactions in DreamFactory? For example, I need to update 2 tables, if one fails, a rollback of the table updates gets executed.


#2

Hi,

Yes, you’re able to do this. Simply use the Live API and (since you want to update) use one of the PATCH rest verbs - there is an option called “rollback” - set this to true and if either update fails then the changes are not saved.

Thanks,

  • Mark

#3

Hello Mark,

We looked at PATCH but this will only rollback on a single table. How can I handle updates that hit two different tables? Commit only if the updates to the 2 tables are successful and rollback updates on the 2 tables if 1 update fails?

Troy


#4

Let’s set up the scenario here, because these two tables must be related in order for them both to be updated in the same api call…unless there has been some sort of scripting implemented on the server-side.

This is how it has been setup on your side, correct? You’ve established a relationship between these two tables originally and now want to rollback if both the related table and the original table aren’t updated. And using the PATCH rollback method is not working, because there are two tables being updated - and it is dependent on the first table being updated (or not)…

So, a quick question for you - assuming the use case is correct - the rollback doesn’t happen if the second (related) table is not updated successfully?

Thank you,

  • Mark