Enabling hstore with a Rails Migration
May 16th, 2014
If you’ve used PostgreSQL before with hstore. I’m sure you’ve come across this while running your migrations.
Then you have to go into your database, enable hstore, but what if you rebuild the database? You run into that problem all over.
The easiest and most reliable solution I’ve found, is to create a migration that runs before all of your other migrations.
Just make sure the timestamp comes before all of the other files, and make the contents of the file look like this:
1 2 3 4 5 6 7 8 9 10
Now, when you migrate your database, the first thing that happens is enabling hstore.