Reputation: 3516
I get these errors when trying to either migrate or db:schema:load on Heroku with Rails 5.0.1
Gemfile
# PostGIS adapter
gem 'activerecord-postgis-adapter'
database.yml
default: &default
adapter: postgis
encoding: unicode
pool: 5
postgis_extension: postgis
schema_search_path: public, postgis
production:
<<: *default
database: appname_production
username: appname
password: <%= ENV['APPNAME_DATABASE_PASSWORD'] %>
Migration
t.st_point :location, geographic: true, null: false
schema.rb
t.geography "location", limit: {:srid=>4326, :type=>"point", :geographic=>true}, null: false
Buildpacks
$ heroku buildpacks
=== appname-staging Buildpack URLs
1. https://github.com/cyberdelia/heroku-geo-buildpack.git
2. heroku/ruby
Running either heroku run rake db:migrate
or heroku run rake db:schema:load
gives NoMethodError: undefined method `st_point'
, NoMethodError: undefined method `geography'
, respectively. How can I fix this? What am I missing?
Upvotes: 2
Views: 837
Reputation: 2668
In case of that this will help someone i manged to solve the issue by using
production:
<<: *default
url: <%= ENV.fetch('DATABASE_URL', '').sub(/^postgres/, "postgis") %>
database: databasename_production
username: databasename
password: <%= ENV['databasename_DATABASE_PASSWORD'] %>
in my database.yml file
Upvotes: 4
Reputation: 3336
Have you tried changing the database url
https://github.com/rgeo/activerecord-postgis-adapter/issues/174
Upvotes: 0