{"action":"created","issue":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1556","repository_url":"https://api.github.com/repos/phoenixframework/phoenix","labels_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1556/labels{/name}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1556/comments","events_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1556/events","html_url":"https://github.com/phoenixframework/phoenix/issues/1556","id":134259368,"number":1556,"title":"Error running mix test without any migrations","user":{"login":"cbarratt","id":1702826,"avatar_url":"https://avatars.githubusercontent.com/u/1702826?v=3","gravatar_id":"","url":"https://api.github.com/users/cbarratt","html_url":"https://github.com/cbarratt","followers_url":"https://api.github.com/users/cbarratt/followers","following_url":"https://api.github.com/users/cbarratt/following{/other_user}","gists_url":"https://api.github.com/users/cbarratt/gists{/gist_id}","starred_url":"https://api.github.com/users/cbarratt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbarratt/subscriptions","organizations_url":"https://api.github.com/users/cbarratt/orgs","repos_url":"https://api.github.com/users/cbarratt/repos","events_url":"https://api.github.com/users/cbarratt/events{/privacy}","received_events_url":"https://api.github.com/users/cbarratt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-17T11:51:04Z","updated_at":"2016-02-17T12:06:04Z","closed_at":null,"body":"I have a Phoenix app which has schema's setup and is utilising a pre-existing database with data. \r\n\r\nI came across quite an unhelpful error message while attempting to create tests for the Phoenix application.\r\n\r\nWhen running `mix test`\r\n\r\n```\r\n** (ArgumentError) cannot load `\"2\"` as type :integer\r\n    (ecto) lib/ecto/repo/queryable.ex:132: Ecto.Repo.Queryable.load!/3\r\n    (ecto) lib/ecto/adapters/sql.ex:515: anonymous fn/3 in Ecto.Adapters.SQL.process_row/3\r\n    (elixir) lib/enum.ex:1151: Enum.\"-map_reduce/3-lists^mapfoldl/2-0-\"/3\r\n    (ecto) lib/ecto/adapters/sql.ex:513: Ecto.Adapters.SQL.process_row/3\r\n    (elixir) lib/enum.ex:1088: Enum.\"-map/2-lists^map/1-0-\"/2\r\n    (ecto) lib/ecto/adapters/sql.ex:283: Ecto.Adapters.SQL.decode/2\r\n    (ecto) lib/ecto/adapters/sql.ex:272: Ecto.Adapters.SQL.decode/3\r\n    (ecto) lib/ecto/adapters/sql.ex:225: Ecto.Adapters.SQL.query/5\r\n```\r\n\r\nAt first I had no idea what was going on and assumed I'd some something wrong in my Elixir code.\r\n\r\nI eventually had a look at `test_helper.exs` and noticed this line:\r\n`Mix.Task.run \"ecto.migrate\", ~w(-r AdminPhoenix.Repo --quiet)`\r\n\r\nWhen I run mix ecto.migrate outside of mix test, I obviously receive the same message.\r\n\r\nThis is potentially quite an odd edge case as most I'd assume are building brand new applications. Though I'd imagine I won't be the only one who wants to build a Phoenix application for an existing database :)\r\n\r\nI'm not sure whether it would warrant a change in Ecto for `ecto.migrate` to tell the user that there are no migrations present, as even that would have helped significantly."},"comment":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/comments/185172912","html_url":"https://github.com/phoenixframework/phoenix/issues/1556#issuecomment-185172912","issue_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1556","id":185172912,"user":{"login":"ericmj","id":316890,"avatar_url":"https://avatars.githubusercontent.com/u/316890?v=3","gravatar_id":"","url":"https://api.github.com/users/ericmj","html_url":"https://github.com/ericmj","followers_url":"https://api.github.com/users/ericmj/followers","following_url":"https://api.github.com/users/ericmj/following{/other_user}","gists_url":"https://api.github.com/users/ericmj/gists{/gist_id}","starred_url":"https://api.github.com/users/ericmj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericmj/subscriptions","organizations_url":"https://api.github.com/users/ericmj/orgs","repos_url":"https://api.github.com/users/ericmj/repos","events_url":"https://api.github.com/users/ericmj/events{/privacy}","received_events_url":"https://api.github.com/users/ericmj/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T12:06:04Z","updated_at":"2016-02-17T12:06:04Z","body":"It's not clear in the issue where the error is coming from. Did removing `Mix.Task.run \"ecto.migrate\"` resolve it? If you run `ecto.migrate` without any migrations it should be a noop, so if anything is breaking it's an ecto bug."}}