Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To use hstore in Ecto schemas you have to create own Ecto type. To do this, follow these steps:
- 1. Create files hstore.ex & hstore_extension.ex inside your lib folder
- 2. Open your database settings and add the following line
- `extensions: [{MyApp.HStoreExtension, nil}],`, for example
- ``` elixir
- config :my_app, MyApp.Repo,
- adapter: Ecto.Adapters.Postgres,
- username: "postgres",
- password: "",
- database: "database_name",
- extensions: [{MyApp.HStoreExtension, nil}],
- size: 100
- ```
- - On postgrex 0.10 onwards, postgrex split the Binary extension across multiple files, so this fork uses the `Postgrex.Extensions.HStore` instead of the `Postgrex.Extensions.Binary`
- - Tested with Ecto 2.0.0-rc.6, Postgrex 0.11.2 and PostgreSQL 9.3.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement