【问题标题】:Rails: PostGIS error when i run rake db:createRails:当我运行 rake db:create 时出现 PostGIS 错误
【发布时间】:2017-07-20 11:42:51
【问题描述】:

我在使用 postgis 时遇到了一些问题。我使用 rails 4,我在 mac osx sierra 10.12 上。

我有一个用于 postgis 的超级用户 ekylibre,我有一个包含以下信息的文件 database.yml:

default: &default
  adapter: postgis
  encoding: unicode
  pool: 5
  postgis_extension: []
  schema_search_path: public,postgis
  username: ekylibre
  password: ekylibre
  host: 127.0.0.1

当我尝试运行时:

rake db:create

我有这个错误:

ActiveRecord::StatementInvalid: PG::UndefinedFile: ERROR: could not 打开扩展控制文件 “/usr/local/Cellar/postgresql@9.5/9.5.7/share/postgresql@9.5/extension/postgis.control”: 没有这样的文件或目录

我当然有 postgis。我使用自制软件安装 postgis。 有人有解决方案或轨道吗? 谢谢你。

【问题讨论】:

    标签: ruby-on-rails ruby macos postgresql postgis


    【解决方案1】:

    当我们使用 postgis 适配器时,我们手动为我们的数据库创建了 postgis 扩展:

    $ psql -c your_database_name
    $ CREATE_EXTENSION postgis
    

    我也不确定你database.yml 的这些字符串

    postgis_extension: []
    schema_search_path: public,postgis
    

    我想,你可以放下它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-13
      • 1970-01-01
      • 2012-10-13
      • 2012-11-23
      • 1970-01-01
      • 2019-07-23
      • 1970-01-01
      相关资源
      最近更新 更多