-
Notifications
You must be signed in to change notification settings - Fork 53
feat: upgrade to Rails 8.1 #386
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
base: master
Are you sure you want to change the base?
Conversation
cb4869f to
d8e3e07
Compare
d8e3e07 to
f9b1c88
Compare
Rails is moving towards ractor compatibility, and to do so it swapped to frozen database objects. Hence we cannot simply memoize the factories anymore. I've checked the initialization speed for factories, and the memoization was too fast for it to be worth implementing a cache. See rails/rails@d2da816 See rails/rails@76448a0
f157af7 to
0cf5c83
Compare
- update some outdated overrides. - update override comments to know when was the last override. - remove the `#column_names_from_column_numbers` method that was generating N+1 queries. - update related methods. See: - rails/rails@249c367 - rails/rails@4e0546c - rails/rails@c93d1b0
ab74ce6 to
dc9a906
Compare
| # | ||
| # @see: https://github.com/rails/rails/blob/8695b028261bdd244e254993255c6641bdbc17a5/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L829 | ||
| # OVERRIDE(v8.1.1): | ||
| # - comment is retrieved differently than PG for performance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
col_description is the method used to retrieve the comment in PG. @rafiss is still true that this is slower than using information_schema.columns ?
| ARRAY( | ||
| SELECT a.attname | ||
| FROM pg_attribute a | ||
| WHERE a.attrelid = d.indexrelid AND a.attishidden | ||
| ) AS hidden_columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafiss
I added this bit. I'm really unsure about performances, any better idea would be appreciated.
The goal is to remove hidden columns from the columns above. My main issue was that we are using pg_get_indexdef to retrieve the columns. I don't know edge cases so I was not eager to use another method, but if we were not to use it I feel like we could easily have a faster and simpler approach.
My second question is: do you have a simple routine to benchmark two slightly different columns in CRDB, and pitfalls I should avoid?
EDIT: one of the ideas I had:
ARRAY(
SELECT a.attname
FROM pg_attribute a
JOIN unnest(d.indkey) AS k(attnum)
ON a.attrelid = d.indrelid AND a.attnum = k.attnum
AND NOT a.attishidden
) AS visible_columns12da876 to
1ec2c3a
Compare
1ec2c3a to
a3bc3d5
Compare
203097e to
35a1516
Compare
35a1516 to
bfa5262
Compare
TODOs:
#foreign_keysworks if t2 doesn't belong to the same namespace as t1