Ash FrameworkAF
Ash Framework8mo ago
9 replies
bhelms

Best way to run bulk ops in a transaction

I’m new to Ash, and I have a fairly simple code problem. I need to delete all the records for a resource for a given user and then bulk create new ones of the same resource for the same user. I want these two bulk operations to be in a transaction so they’re rolled back on error. I’ve been able to do this in a generic action by using bulk_destroy followed by bulk_create. However, I’ve not been able to figure out how to do this in a multi-step way by using callbacks (to delete first) which seems like it would be the Ash way.

Am I missing something or is a generic action the way to go?
Was this page helpful?