Friday, February 7, 2025

Support joins in update_all for PG and SQLite and more

Posted by Wojtek

Hi, Wojtek here presenting you this week’s changes in the Rails codebase.

Clio joins the Rails Foundation
We’re excited to welcome Clio as the newest Contributing Member of the Rails Foundation.

Support joins in update_all for Postgresql and SQlite
Previously when generating update queries with one or more JOIN clauses, Active Record would use a sub query which would prevent to reference the joined tables in the SET clause, for instance:

Comment.joins(:post).update_all("title = posts.title")

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.

Rate limit password resets in auth generator
This helps mitigate abuse from attackers spamming the password reset form.

Enable statement-cached queries to be retryable
Enable automatically retrying idempotent association queries on connection errors.

Add allow_retry to sql.active_record
This enables identifying queries which queries are automatically retryable on connection errors.

Migrate multiple DBs with pending migration action
Fix migrating multiple databases with ActiveRecord::PendingMigration action.

Speed up Docker build
By removing recursive chown command in the default Dockerfile template, docker build should now be a bit faster.

You can view the whole list of changes here. We had 19 contributors to the Rails codebase this past week!

Until next time!

Subscribe to get these updates mailed to you.