Closed nerus closed 7 years ago
Which version of Ecto are you using? Remember that tds_ecto does not work yet with Ecto 2 #34
This config is in mix.exs file
def application do [mod: {AppRest, []}, applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext, :phoenix_ecto, :tds_ecto]] end
defp deps do [{:phoenix, "~> 1.2.1"}, {:phoenix_pubsub, "~> 1.0"}, {:phoenix_ecto, "~> 2.0"}, {:phoenix_html, "~> 2.6"}, {:phoenix_live_reload, "~> 1.0", only: :dev}, {:gettext, "~> 0.11"}, {:cowboy, "~> 1.0"}, {:tds_ecto, "~> 1.0.2"}] end
Could you post your mix.lock file?
the mix.lock file mix_lock.txt
I had a similar problem. The workaround I found was (kind of ugly): :model schema "schema].[table"
- this should generate a SELECT ... FROM [schema].[table] ...
.
It is supported now in ecto2 branch. It is still WIP. It works the same way as it was done in psotgresql adapter
This is now supported in latest master branch which is supporting ecto up to version 2.1.X. You have to use @prefix "schema"
above schema macro.
I have a model like this
defmodule AppRest.Category do use AppRest.Web , :model schema "ventas.categories" do field :name, :string timestamps() end
when i use it in the controller, with Repo.alldef index(conn, _params) do categories = Repo.all(Category) render(conn, "index.json", categories: categories) end
it generate the query like thisSELECT g0.[id], g0.[name], g0.[inserted_at], g0.[updated_at] FROM [global.categories] AS g0
then MSSQL can't process the query and return this error: "The object name 'Ventas.categories' is not valid." The query in right format is like thisSELECT g0.[id], g0.[name], g0.[inserted_at], g0.[updated_at] FROM [global].[categories] AS g0
So the question is how i can set the name of schema of the table of MSSQL, in the model?
I hope any can help me with this.