Ecto delete a record WITHOUT selecting first

Thank you! Just to show a more thorough example:

{rows_deleted, _} = from(x in DataModel, where: x.id == ^id) |>; Repo.delete_all

You might get zero as the number of rows deleted.

1 Like