我正在rails应用程序中集成PostGIS,并遵循它们的文档https://github.com/rgeo/activerecord-postgis-adapter.
在这个步骤
rake db:create
我得到以下错误。
ActiveRecord::StatementInvalid:PG::SyntaxError:ERROR:"SUPPORT"处或附近的语法错误:如果不存在,则创建扩展使用SCHEMA公共的postgis
我的数据库.yml
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
adapter: postgis
encoding: unicode
postgis_extension: postgis # default is postgis
postgis_schema: public # default is public
schema_search_path: public,postgis
pool: 5
database: my_app_development # your database name
test:
<<: *default
database: my_app_test
production:
<<: *default
database: my_app_production
username: my_app
password: <%= ENV['MY_APP_DATABASE_PASSWORD'] %>
只需删除database.yml
中不需要的所有选项。
default: &default
adapter: postgis
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: my_app_development # your database name
test:
<<: *default
database: my_app_test
production:
<<: *default
database: my_app_production
username: my_app
password: <%= ENV['MY_APP_DATABASE_PASSWORD'] %>