Are Ecto.Multi or something equivalent supported in Ash?
Can I use Ecto.Multi or something equivalent to create more complex database queries inside a transaction using multiple resources?
3 Replies
Yes, you can use Ecto.Multi with ash resources. You can also use
Ash.Flow
In Ash.Flow documenation, it says "...steps that are enclosed by a transaction. "
Is this done automatically by Ash or should I do it somehow?
Is there an example of that somewhere in the docs?
There is a transaction step that will wrap steps in a transaction, and additionally if a step for a resource is in a transaction it will run synchronously. You can also set the
touches_resources
on most steps in case there are other resources with other repos, or custom steps. You usually don’t need it though.