Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.html#c:delete/2 has examples, but they are all doing 2 operations: a select, then a delete.
In the interest of optimization, is it possible with Ecto to delete a record with a single operation? Something like the SQL query DELETE FROM my_table WHERE id=123 ?
Is it considered bad form to delete without selecting first?
I think you have to do a query to pass existing rows to delete or delete_all,
because they require the Ecto metadata element of the struct to contain the ‘loaded’ flag.
The only alternative would be to completely fake the whole struct,
including all the internal fields and flags.
But I agree with you that there should be a version of delete,
which just takes a primary key value, by analogy with the ‘get’ function.