I’m using Rails 3.1, and I have tables with the PostGIS geometry datatype. These don’t seem to be compatible with rake db:schema:dump or rake db:test:clone and the rake test:* tasks. The tables containing this datatype are simply not processed and instantiated by these rake tasks.
Is there any patch or solution for this?
There is a solution:
First of all, you need a PostgreSQL
templatewith PostGIS functions support.Create a template database:
Load necessary PostGIS functions into template (I’m using Homebrew, so find the paths to your PostGIS SQL files):
Set database as template and grant permissions:
Then, add
gem 'postgis_adapter'to yourGemfileand runbundle.After that add
template: template_postgisto yourconfig/database.ymllike this:And – voila! Welcome on board!