Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails 4 postgres 9.4.5 #13

Open
epipheus opened this issue Feb 20, 2016 · 3 comments
Open

rails 4 postgres 9.4.5 #13

epipheus opened this issue Feb 20, 2016 · 3 comments

Comments

@epipheus
Copy link

Primary keys are not set in Rails 4, postgres using your migrations. Weird.

@mattbeedle
Copy link
Owner

Not all tables have primary keys. Some use compound keys.

---Sent from Boxer | http://getboxer.com

On 21 February 2016 at 06:02:37 GMT+7, Michael Madison [email protected] wrote:Primary keys are not set in Rails 4, postgres using your migrations. Weird. —Reply to this email directly or view it on GitHub.

@epipheus
Copy link
Author

But even the primary keys I see you explicitly set are ignored by Postgres.
It's weird. I saw a workaround on StackOverflow that in the migration
saying t.primary_key = :some_column works instead of defining before the
migration block. Will try.

Sent from my iPhone

Michael K. Madison II.
Managing Director
Cocoon Ventures
http://www.cocoonventures.com

On Feb 20, 2016, at 11:15 PM, Matt Beedle [email protected] wrote:

Not all tables have primary keys. Some use compound keys.

---Sent from Boxer | http://getboxer.com

On 21 February 2016 at 06:02:37 GMT+7, Michael Madison <
[email protected]> wrote:Primary keys are not set in Rails 4,
postgres using your migrations. Weird. —Reply to this email directly or
view it on GitHub.


Reply to this email directly or view it on GitHub
#13 (comment)
.

@mattbeedle
Copy link
Owner

I've actually just refactored the migrations in a backwards incompatible way and bumped the gem to 2.0. I removed primary keys from several tables and used composite keys instead, to reflect the way the data is actually organised in the USDA source. Also, added a unique index to usda_foods#nutrient_databank_number which may have been the issue there. Perhaps that helps?

I also cut import time down to about 2 minutes from 60+ if you are prepared to add the activerecord-import gem to your project.

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

No branches or pull requests

2 participants