As supplementary:
- above code just do data consistency, it is not helpful for user experience —— You shouldn’t just popup a model, and tell users “database error occurs”.
- try to use
Ecto.Changeset.no_assoc_constraintbefore deleting any referenced rows,:on_deleteis just the last line of defense for data consistency.






















