-
Notifications
You must be signed in to change notification settings - Fork 354
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
Is gem still relevant with Rails 7.1? #608
Comments
I probably would not consider using CPK for a new project, if you're just now starting one. While I haven't checked out Rails 7.1 yet, for my project, if it's easy enough to migrate over, and isn't hampered by performance issues, we'll be doing that. I only plan on keeping CPK updated in our project if it's not easy enough to switch to Rails' version. (Note I am not the decision maker on this -- just giving my 2 cents, having contributed some updates to this gem) |
As far as I can tell that comment in the release notes is at best misleading - if you read the linked blog post about what Shopify actually did you'll see that while they had a composite primary key in the database they still had a unique ID field which they used as the "primary key" in rails. I've seen no evidence so far that rails 7.1.0 can actually handle multipart primary keys as a way of identifying records or joining tables - if it is possible then there is no documentation that I can find on how to do it. |
I take it all back - the documentation is at https://guides.rubyonrails.org/active_record_composite_primary_keys.html and it does seem to work. The bizarre thing is that while you can set |
I agree with you, @tomhughes, the need for |
I would love to see this gem to support Rails 7.1 until the CPK implementation in Rails is mature. |
I was able to successfully switch https://github.com/openstreetmap/openstreetmap-website to rails 7.1 with the builtin CPK support in openstreetmap/openstreetmap-website#4278 basically just be either dropping the primary key assignment or changing |
Thanks for the info @tomhughes. So it seems there is no point in doing a 7.1 release for CPK then? |
FYI: I have opened a bug report on rails regarding composite primary keys: |
For whatever my vote is worth, I'd still like a 7.1 release and to use this gem for the foreseeable future. I have my own gem that maintains compatibility with several Rails versions. I'd rather not have to put logic in my gem's models just to use different syntax depending on the Rails version. (I also don't want to immediately drop support for all Rails < 7.1.) |
I'd also like a release of this gem for Rails 7.1, if possible. Best to upgrade in small steps I think, and dropping both this gem and upgrading to Rails 7.1 in one go is too much. |
Based on rails/rails#49622 (comment), I also also suggest maintaining this gem until Rails 8. |
Hello! I'm curious to know if there are plans for CPK to support Rails 7.1. |
The comments above indicate that switching to Rails built-in support for composite keys is not hard to do. In addition, upgrading CPK for major new Rails versions is quite difficult and time consuming (at least days of work if not a week or two). And I suspect this upgrade might be quite difficult since Rails 7.1 has likely changed most of the code CPK changes. Between those two facts, I hope it will not be necessary to upgrade this gem for 7.1. So I don't plan on updating CPK for Rails 7.1. I am happy to review PRs if someone wants to try though. |
Yet another reason for maintaining this gem (until Rails has matured on CPK): rails/rails#51231 |
Rails 7.1 (currently available as RC) supports composite keys.
Does it make sense to use this gem in Rails 7.1 or above? Is the Rails support equivalent, or does the gem offer anything extra?
The text was updated successfully, but these errors were encountered: