我已经使用自制软件更新到最新版本的 postgis。(2.1)
brew unlink postgis
brew install postgis
然后我创建了一个迁移以将 postgis 扩展更改为 2.1
rails g migration alter_postgis_version
def change
execute %q{ALTER EXTENSION postgis UPDATE TO "2.1.0";}
end
编辑:
在第一条评论中运行 brew 命令,现在我在迁移时收到以下错误:
PG::UndefinedObject: ERROR: type "geometry" does not exist:
CREATE EXTENSION postgis_tiger_geocoder;/me/.rvm/gems/ruby-2.0.0-
p247@freight_alert/gems/activerecord4.0.0/
lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `exec'
我在 postgis 模式下设置了 postgis,所以如果我运行
$: set search_path = "$user", postgis,public;
$: \d
List of relations
Schema | Name | Type | Owner
---------+--------------------------+----------+-------------------
postgis | geography_columns | view | me
postgis | geometry_columns | view | me
etc..
$: \d geometry_columns
View "postgis.geometry_columns"
Column | Type | Modifiers
-------------------+------------------------+-----------
f_table_catalog | character varying(256) |
f_table_schema | character varying(256) |
f_table_name | character varying(256) |
f_geometry_column | character varying(256) |
coord_dimension | integer |
srid | integer |
type | character varying(30) |
但是,如果我尝试运行:
$: CREATE EXTENSION postgis_tiger_geocoder;
ERROR: type "geometry" does not exist
这对我来说没有任何意义,因为 geometry_columns 在关系列表中。