Created
July 13, 2015 21:06
-
-
Save stoft/43572de1f8b387e62721 to your computer and use it in GitHub Desktop.
Ecto touchpoints in Phoenix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These are most of the Ecto touchpoints within Phoenix. | |
# I may have missed a few though. | |
# / | |
## mix.exs | |
:postgrex, :phoenix_ecto | |
# web/ | |
## web.ex | |
* controller & channel | |
alias MyApp.Repo | |
import Ecto.Model | |
import Ecto.Query, only: [from: 2] | |
# test/ | |
## test_helper.ex | |
Mix.Task.run "ecto.create", ["--quiet"] | |
Mix.Task.run "ecto.migrate", ["--quiet"] | |
Ecto.Adapters.SQL.begin_test_transaction(MyApp.Repo) | |
## model_case.ex & conn_case.ex & channel_case.ex | |
alias MyApp.Repo | |
import Ecto.Model | |
import Ecto.Query, only: [from: 2] | |
unless tags[:async] do | |
Ecto.Adapters.SQL.restart_test_transaction(MyApp.Repo, []) | |
end | |
# lib/ | |
## my_app/repo.ex | |
use Ecto.Repo, otp_app: :my_app | |
## my_app.ex | |
worker(MyApp.Repo, []), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment