|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Support joins in update_all for PG and SQLite and more" |
| 4 | +categories: news |
| 5 | +author: Wojtek |
| 6 | +og_image: assets/images/this-week-in-rails.png |
| 7 | +published: true |
| 8 | +date: 2025-02-07 |
| 9 | +--- |
| 10 | + |
| 11 | + |
| 12 | +Hi, [Wojtek](https://x.com/morgoth85) here presenting you this week's changes in the Rails codebase. |
| 13 | + |
| 14 | +[Clio joins the Rails Foundation](https://rubyonrails.org/2025/2/3/clio-joins-rails-foundation) |
| 15 | +We’re excited to welcome [Clio](https://www.clio.com/) as the newest Contributing Member of the Rails Foundation. |
| 16 | + |
| 17 | +[Support joins in update_all for Postgresql and SQlite](https://github.com/rails/rails/pull/53950) |
| 18 | +Previously when generating update queries with one or more JOIN clauses, |
| 19 | +Active Record would use a sub query which would prevent to reference the joined |
| 20 | +tables in the *SET* clause, for instance: |
| 21 | + |
| 22 | +```ruby |
| 23 | +Comment.joins(:post).update_all("title = posts.title") |
| 24 | +``` |
| 25 | + |
| 26 | +This is now supported as long as the relation doesn't also use a *LIMIT*, *ORDER* or *GROUP BY* clause. This was supported by the MySQL adapter for a long time. |
| 27 | + |
| 28 | +[Rate limit password resets in auth generator](https://github.com/rails/rails/pull/54442) |
| 29 | +This helps mitigate abuse from attackers spamming the password reset form. |
| 30 | + |
| 31 | +[Enable statement-cached queries to be retryable](https://github.com/rails/rails/pull/54436) |
| 32 | +Enable automatically retrying idempotent association queries on connection errors. |
| 33 | + |
| 34 | +[Add allow_retry to sql.active_record](https://github.com/rails/rails/pull/54454) |
| 35 | +This enables identifying queries which queries are automatically retryable on connection errors. |
| 36 | + |
| 37 | +[Migrate multiple DBs with pending migration action](https://github.com/rails/rails/pull/54456) |
| 38 | +Fix migrating multiple databases with *ActiveRecord::PendingMigration* action. |
| 39 | + |
| 40 | +[Speed up Docker build](https://github.com/rails/rails/pull/54428) |
| 41 | +By removing recursive *chown* command in the default Dockerfile template, docker build should now be a bit faster. |
| 42 | + |
| 43 | + |
| 44 | +_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B2025-01-31%7D...main@%7B2025-02-07%7D)._ |
| 45 | +_We had [19 contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20250131-20250207) to the Rails codebase this past week!_ |
| 46 | + |
| 47 | +Until next time! |
| 48 | + |
| 49 | +_[Subscribe](https://world.hey.com/this.week.in.rails) to get these updates mailed to you._ |
0 commit comments