SchemaPlus / schema_plus

SchemaPlus provides a collection of enhancements and extensions to ActiveRecord
Other
680 stars 84 forks source link

foreign key creation fails silently with activerecord-postgis-adapter 0.6.5 #120

Open wrkrb33 opened 11 years ago

wrkrb33 commented 11 years ago

No foreign key constraint is created with the following migration:

def change
  create_table :a_tester do |t|
    t.integer :county_id, :foreign_key=>{:references=>:counties}
    t.timestamps
  end
end

If I change database.yml to use the postgresql adapter instead, then it works as expected.

However, db:schema:dump does dump existing foreign key constraints, regardless of which adapter is used.

ronen commented 11 years ago

Yeah, PostGIS isn't on the "officially supported" list, i.e. it's not in the travis-ci test suite. Maybe it should be? But I'm not familiar with PostGIS myself so not in a good position to dive in and make it work and maintain it.

Others have used PostGIS with schema_plus in the past, and have contributed to making it work, as per #94... (@pete are you still out there?)

wrkrb33 commented 11 years ago

I am not familiar with travis-ci, though I did manage to find that the adapter in question is in fact in the suite at:

dazuma/activerecord-postgis-adapter

Is that helpful?

pete commented 11 years ago

@ronen I am still out here. ☺

Interesting bug. I'll see if I can slice off some time to investigate today or this week, though I hesitate to make promises. I suspect there's a trivial fix.

ronen commented 11 years ago

@wrkrb33 thanks, but the issue isn't so much finding the adapter as making it work with schema_plus. and i wasn't clear regarding the test suite: i meant i've not configured schema_plus's travis-ci setup to include postgis, so there's no assurance that schema_plus will continue to work with postgis. in that sense, postgis isn't "officially supported"

if somebody out there in github-land was able to

  1. get schema_plus working working with postgis again,
  2. add any posgis-specific testing if necessary to make sure it works and all code is covered by tests, and
  3. configure travis-ci to include it in the test matrix,

then i'd be ok with pulling it all into schema_plus and thereby "officially" supporting postgis from then on.

but i'm unfortunately not in a position to do all that myself, so need to wait for somebody else's good graces...

ronen commented 11 years ago

@pete hi again! sorry your comment came in while i was in the midst of composing my previous one.

FYI i'll probably accept a trivial fix same as with #94, but of course if postgis support is really important then getting it fully tested and in the travis-ci matrix as per my previous comment would be the way to go.

i understand no promises though :)

tovodeverett commented 11 years ago

In a semi-related note, today's Ruby Weekly had a reference to a blog post by Nick Gauthier about using PostGIS with the PostgreSQL adapter (instead of the PostGIS adapter). I'm curious if his approach would work with using schema_plus to handle the expression index.

If @pete doesn't get to this in the next week or two, I may take a stab at it (but given that I have no PostGIS experience at all, he's more likely to be successful).