rgeo/activerecord-postgis-adapter

Schema.rb + UUID breaks

Closed this issue · 4 comments

I'm having an issue where my schema in schema.rb is altered incorrectly.

I added the gem to an existing rails 4.2 project running postgresql 9.3.6. I've installed postgis 2.1.2.

Note that I'm also using the uuid-ossp extension so that my rails models can utilize a UUID-based id column for the primary key.

After install the gem (3.0.0.beta2) and updating my database.yml accordingly, I will run the next migration (or just run rake db:schema:dump) and every table in my schema.rb has its "default" option changed from "uuid_generate_v4()" to nil, e.g.

#original
create_table "users", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| 

#after postgis and rake db:schema:dump
create_table "users", id: :uuid, default: nil, force: :cascade do |t|

I backed out the gem and related changes and then tried to manually enable postgis ("CREATE EXTENSION postgis;"), followed by "rake db:schema:dump" and the issue does not occur.

Thanks in advance for any advice.

I raised the above Rails ticket as I first thought this was an issue with Rails. However after a bit more investigation have isolated the problem to the postgis adapter. We're also using uuid's and getting default: nil incorrectly dumped into schema.rb

I just ran into this issue today, it looks like if you update from 3.0.0.beta2 to the full 3.0.0 release the issue is resolved.

Can confirm that updating to the full release resolves the issue

@michaelkelly322 @desaperados thanks for reporting on this issue.

Closing as fixed in 3.0.0.