rgeo / activerecord-postgis-adapter

ActiveRecord connection adapter for PostGIS, based on postgresql and rgeo
Other
880 stars 242 forks source link

rake db:test:prepare fails in Rails 4 #83

Closed petergoldstein closed 9 years ago

petergoldstein commented 11 years ago

I'm seeing a fatal error when I run rake db:test:prepare after upgrading to Rails 4. This is the error:

** Execute db:test:purge
rake aborted!
PG::DuplicateObject: ERROR:  type "spheroid" already exists

The error seems to occur because the postgis.sql script is being run twice, and the CREATE TYPE spheroid statement in the file cannot be safely run twice.

swebb commented 11 years ago

I just ran into this problem. The mistake I was making is my database.yml was specifying the postgis template.

template: template_postgis

The template was being loaded twice (once for the template line, and once by the postgis adapter). Removing the template line fixed the problem for me.

petergoldstein commented 11 years ago

@swebb Interesting. I don't have a template line in my database.yml. The only postgis specific lines I have (other than the adapter) are:

schema_search_path: "public,postgis,tiger"
script_dir: /usr/local/share/postgis
su_username: XXXX
su_password: XXXX
teeparham commented 9 years ago

This should be fixed in version 2.2 and later. Closing as stale.