I’d like to use Mnesia in a small prototype, but I don’t think I’m ready to deal with its Erlang API yet. So, I’m looking into the existing Elixir wrappers: Memento and ecto_mnesia. Any preference and/or opinions from people who have used them?
For the moment, I like that ecto_mnesia will allow me to switch DBs in the future if that becomes necessary. Anything else I should be aware of?
We have been using ecto_mnesia for ~a year now and are currently in the process of switching to a different DB. This reasoning is correct and I suggest to do it, but be aware that ecto_mnesia is not a fault-free Ecto implementation. The main things we hit against were:
Ecto.Streams are not supported. There is an alternative EctoMnesia.Table.Stream but it does not return Ecto structs but rather the underlying records for some reason.
Preloading is not supported and has to be done manually for now.
Ecto.Multi is supported, but errors raised (or rolled back) are not properly forwarded to the outer scope.
And finally, ecto_mnesia is configured in part itself, and in part by configuring :mnesia. Doing this properly is a bit finnicky.
But especially for a small prototype, I’d say: Go for it!