To use hstore in Ecto schemas you have to create own Ecto type. To do this, follow these steps:
- Create files hstore.ex & hstore_extension.ex inside your lib folder
- Open your database settings and add the following line
extensions: [{MyApp.HStoreExtension, nil}],
, for example
config :my_app, MyApp.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "",
database: "database_name",
extensions: [{MyApp.HStoreExtension, nil}],
size: 100
P.S. Tested with Ecto 0.12.0-rc, Postgrex 0.8.4 and PostgreSQL 9.4
stopped working when I upgraded postgrex to 0.11 mainly because Postgrex.Extensions.Binary was deprecated.