How to bind a field to a column with a different name using Elixir Ecto

I am trying to create a small application that will connect to an obsolete db. Is there a way to define an Ecto model with attribute names other than table columns?

Sort of:

schema "oauth_access_tokens" do
  field :token
  field :user_id, :integer, column: :resource_owner_id
end
+4
source share
1 answer

Unfortunately, I do not think this is possible now.

A possible solution is to use database-level views, but I'm not sure if this is a good idea.

+3
source

Source: https://habr.com/ru/post/1625785/


All Articles