Article on Ecto 2.0.0 SQL.Sandbox - kindly please review

36 views
Skip to first unread message

Qertoip

unread,
Mar 3, 2016, 4:19:44 AM3/3/16
to elixir-ecto

I have described the SQL.Sandbox and ownership modes to the best of my understanding:

http://tinyurl.com/jr6u2pw


I'm into Elixir only for a few weeks now and fear my incompetence. I would be grateful if you could review this for factual correctness to not spread any misinformation. Many thanks in advance!

José Valim

unread,
Mar 3, 2016, 4:39:58 AM3/3/16
to elixi...@googlegroups.com
Thank you for writing about it Piotr!

Great analysis of the ownership modes in the blog post. The only note maybe worth adding is that the :shared mode is exactly how it worked with Ecto 1.x.

I hope that once folks become a bit more comfortable with manual and shared mode, it will be easier to just start with manual mode and setup shared when you need it. In fact, we should probably ship with this setup for Phoenix:

setup config do
  :ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)

  if !config[:async] do
    :ok = Ecto.Adapters.SQL.Sandbox.mode(Repo, {:shared, self()})
  end

  :ok
end

This way we run in shared mode by default and folks will have problems only if they are trying to make their tests async in the first place.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/ba9c9596-2db7-4e24-89d8-b905b9b4c0b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Qertoip

unread,
Mar 3, 2016, 5:51:55 AM3/3/16
to elixir-ecto
Thanks, notes added!

+1 for this phoenix setup.
Reply all
Reply to author
Forward
0 new messages