{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/1251","repository_url":"https://api.github.com/repos/elixir-lang/ecto","labels_url":"https://api.github.com/repos/elixir-lang/ecto/issues/1251/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ecto/issues/1251/comments","events_url":"https://api.github.com/repos/elixir-lang/ecto/issues/1251/events","html_url":"https://github.com/elixir-lang/ecto/issues/1251","id":134040336,"number":1251,"title":"Repo module is not loaded when executing mix tasks using ecto 2.0.0-beta.0 ","user":{"login":"Sbfrr","id":6023927,"avatar_url":"https://avatars.githubusercontent.com/u/6023927?v=3","gravatar_id":"","url":"https://api.github.com/users/Sbfrr","html_url":"https://github.com/Sbfrr","followers_url":"https://api.github.com/users/Sbfrr/followers","following_url":"https://api.github.com/users/Sbfrr/following{/other_user}","gists_url":"https://api.github.com/users/Sbfrr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sbfrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sbfrr/subscriptions","organizations_url":"https://api.github.com/users/Sbfrr/orgs","repos_url":"https://api.github.com/users/Sbfrr/repos","events_url":"https://api.github.com/users/Sbfrr/events{/privacy}","received_events_url":"https://api.github.com/users/Sbfrr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-02-16T17:16:07Z","updated_at":"2016-02-22T21:53:30Z","closed_at":"2016-02-17T08:43:37Z","body":"Here is the stacktrace when doing ``` mix ecto.create -r EctoTest.Datastores.PG ``` :\r\n``` elixir\r\n** (UndefinedFunctionError) undefined function EctoTest.Datastores.PG.__adapter__/0 (module EctoTest.Datastores.PG is not available)\r\n    EctoTest.Datastores.PG.__adapter__()\r\n    anonymous fn/1 in Mix.Tasks.Ecto.Create.run/1\r\n    (elixir) lib/enum.ex:2400: Enum.do_all?/2\r\n    lib/mix/tasks/ecto.create.ex:27: Mix.Tasks.Ecto.Create.run/1\r\n    (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2\r\n```\r\n\r\nWhen starting the project with ```  iex -S mix ```   : \r\n``` elixir\r\niex(1)> EctoTest.Datastores.PG\r\nEctoTest.Datastores.PG\r\niex(2)> EctoTest.Datastores.PG.__adapter__\r\nEcto.Adapters.Postgres\r\n```\r\n\r\nMy config file:\r\n``` elixir\r\nuse Mix.Config\r\n\r\nconfig :ecto_test, EctoTest.Datastores.PG,\r\n  adapter: Ecto.Adapters.Postgres,\r\n  database: \"ecto_test_dev\",\r\n  username: \"Sebastien\",\r\n  hostname: \"127.0.0.1\",\r\n  port: 5432\r\n```\r\n\r\nThe problem is not happening when switching back to a the previous ecto version 1.1.3.\r\nI guess it's related to a problem of loading modules before executing the task but I'm not sure on how you wanna handle this.\r\n\r\nHere is a small mix project reproducing the issue, just clone the project, update the config with your local pg config and then:\r\n``` \r\nmix deps.get\r\nmix ecto.create\r\n```\r\n\r\nLet me know if I can help with this.\r\n"},"comment":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/comments/187403533","html_url":"https://github.com/elixir-lang/ecto/issues/1251#issuecomment-187403533","issue_url":"https://api.github.com/repos/elixir-lang/ecto/issues/1251","id":187403533,"user":{"login":"matrinox","id":4261980,"avatar_url":"https://avatars.githubusercontent.com/u/4261980?v=3","gravatar_id":"","url":"https://api.github.com/users/matrinox","html_url":"https://github.com/matrinox","followers_url":"https://api.github.com/users/matrinox/followers","following_url":"https://api.github.com/users/matrinox/following{/other_user}","gists_url":"https://api.github.com/users/matrinox/gists{/gist_id}","starred_url":"https://api.github.com/users/matrinox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrinox/subscriptions","organizations_url":"https://api.github.com/users/matrinox/orgs","repos_url":"https://api.github.com/users/matrinox/repos","events_url":"https://api.github.com/users/matrinox/events{/privacy}","received_events_url":"https://api.github.com/users/matrinox/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T21:53:30Z","updated_at":"2016-02-22T21:53:30Z","body":"Thanks ! :+1:"}}