rgeo/activerecord-postgis-adapter

Column type migration when updating from 2.x to 3.x

Closed this issue · 4 comments

As I have update active record to 4.2, I have to update the postgis adapter.
I would like to use st_point instead of point so I've created a migration and it fails.

change_column :region_points, :lonlat, :st_point, geographic: true

I get PG::UndefinedObject: ERROR: type "st_point" does not exist

You do not need to change the column type in a migration when you upgrade the adapter to 3.0 since the column type in the database is the same. Only the syntax for specifying the column type in migrations has changed.

After upgrading the gem, run rake db:schema:dump to dump the schema in the new format. Your schema file (schema.rb) may be slightly different. If you're using a SQL structure, rake db:structure:dump will produce the same structure file (structure.sql).

Thank for the advice.

I was on the verge of changing it by hand. Thanks a lot!

This saved me a ton of time, thanks!