I have a table A that has_many B and also A has_many C, through: B.
I am trying to set up a soft deletion system in Ecto where fetching a record from A from the DB and its associated Bs and Cs, I could update all at the same time A, its Bs, its Cs with one value : state
: :deleted
. (they each have a state
column).
How can I do this ? I’ve tried looking at cast_assoc
or put_assoc
but I feel like it isn’t exactly what I am looking for.
Hope my explanation is clear, let me know if it isn’t, I’ll try to explain better.
Thanks!
Edit : I’m not familiar with it but perhaps using Ecto.Multi could do the trick?