Add a new public API for broadcasting logs
This feature existed for a while but was until now a private API.
Broadcasting log allows to send log message to difference sinks (STDOUT, a file ...) and
is used by default in the development environment to write logs both on STDOUT and in the
"development.log" file.
Basic usage:
stdout_logger = Logger.new(STDOUT)
file_logger = Logger.new("development.log")
broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger, file_logger)
broadcast.info("Hello!") # The "Hello!" message is written on STDOUT and in the log file.
Adding other sink(s) to the broadcast:
broadcast = ActiveSupport::BroadcastLogger.new
broadcast.broadcast_to(Logger.new(STDERR))
Remove a sink from the broadcast:
stdout_logger = Logger.new(STDOUT)
broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger)
broadcast.stop_broadcasting_to(stdout_logger)
Edouard Chin
Fix Range#overlap? not taking empty ranges into account on Ruby < 3.3
Nobuyoshi Nakada, Shouichi Kamiya, Hartley McGuire
Use Ruby 3.3 Range#overlap? if available
Yasuo Honda
Better naming for unique constraints support.
Naming unique keys leads to misunderstanding it's a short-hand of unique indexes.
Just naming it unique constraints is not misleading.
In Rails 7.1.0.beta1 or before:
add_unique_key :sections, [:position], deferrable: :deferred, name: "unique_section_position"
remove_unique_key :sections, name: "unique_section_position"
Now:
add_unique_constraint :sections, [:position], deferrable: :deferred, name: "unique_section_position"
remove_unique_constraint :sections, name: "unique_section_position"
Ryuta Kamizono
Fix duplicate quoting for check constraint expressions in schema dump when using MySQL
A check constraint with an expression, that already contains quotes, lead to an invalid schema
dump with the mysql2 adapter.
Fixes #42424.
Felix Tscheulin
Performance tune the SQLite3 adapter connection configuration
For Rails applications, the Write-Ahead-Log in normal syncing mode with a capped journal size, a healthy shared memory buffer and a shared cache will perform, on average, 2× better.
Stephen Margheim
Allow SQLite3 busy_handler
to be configured with simple max number of retries
Retrying busy connections without delay is a preferred practice for performance-sensitive applications. Add support for a database.yml
retries
integer, which is used in a simple busy_handler
function to retry busy connections without exponential backoff up to the max number of retries
.
Stephen Margheim
The SQLite3 adapter now supports supports_insert_returning?
Implementing the full supports_insert_returning?
contract means the SQLite3 adapter supports auto-populated columns (#48241) as well as custom primary keys.
Stephen Margheim
Ensure the SQLite3 adapter handles default functions with the ||
concatenation operator
Previously, this default function would produce the static string "'Ruby ' || 'on ' || 'Rails'"
.
Now, the adapter will appropriately receive and use "Ruby on Rails"
.
change_column_default "test_models", "ruby_on_rails", -> { "('Ruby ' || 'on ' || 'Rails')" }
Stephen Margheim
Dump PostgreSQL schemas as part of the schema dump.
Lachlan Sylvester