Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

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

Open
wrkrb33 opened this issue Aug 21, 2013 · 6 comments
Open

Comments

@wrkrb33
Copy link

wrkrb33 commented Aug 21, 2013

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
Copy link
Member

ronen commented Aug 21, 2013

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
Copy link
Author

wrkrb33 commented Aug 22, 2013

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
Copy link
Contributor

pete commented Aug 22, 2013

@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
Copy link
Member

ronen commented Aug 22, 2013

@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
Copy link
Member

ronen commented Aug 22, 2013

@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
Copy link
Member

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants