hstore You Just Might Enjoy Shopping There
At work, I've been lucky enough to be developing an entirely event driven application (more on that in the future). I knew it would be an interesting challenge, but I didn't realize how much I'd enjoy it.
Being a green field app, we're using a number of technologies and services that have me excited. While it took me a bit of diliberation to decide on, the piece that has really surpised me and expanded my architectural thinking is PostgreSQL's hstore. In hindsight the fact that hstore is allowing us the flexibility to prototype quickly, is less surprising than the fundamental shift in how I've started thinking about storing an retrieving data.
If you're interested in checking out hstore, I recommend the following stops:
- hstore docs
- activerecord-postgres-hstore gem
- Railscasts (as usual is excellent)
- Heroku hstore example app
- You got NoSQL in my Postgres! Using Hstore in Rails
The one bit that took me some time to find was about getting hstore running in my Rails test environment. Rails' default schema load doesn't enable the Postgres extension (as happens in
rake db:test:prepare). To have hstore enabled you'll need to uncomment or add the following line in
config.active_record.schema_format = :sql
This will change your schema dumps from Ruby to SQL. If you're unsure about the implications of this change, you can learn more in this Rails Guide.October 27 2012