I’m having a bit of a problem with an application I’m currently
developing with Rails 1.2.3 and PostgreSQL, attempting to use test-first
development. Here’s the scenario:
I have the usual three databases, with migrations. Testing has been
I need to store geographic data, so I add PostGIS to all three
databases (along with SpatialAdapter – thanks, Guilhem!). Development
and production databases are happy.
However, testing no longer works. Why? Because the test database is
always dropped and recreated – so that all the PostGIS goodness goes
bye-bye before each round of tests.
It is not feasible to put the PostGIS infrastructure in a YAML fixture
file or a Ruby migration (the damned thing is huge!). However,
PostgreSQL allows a template to be specified when creating a database –
so my troubles would be over if I could specify something like
“template: template_postgis” in database.yml. But that doesn’t seem to
So…is there a way to specify which template the test database will be
created from in PostgreSQL? If not, what should I do?
Web developer / Composer
Albany, NY, US
marnen AT marnen DOT org