2019-07-12 13:57:30 -04:00
* Add `ActiveRecord::Validations::NumericalityValidator` with
support for casting floats using a database columns' precision value.
*Gannon McGibbon*
2019-12-29 14:34:46 -05:00
* Enforce fresh ETag header after a collection's contents change by adding
ActiveRecord::Relation#cache_key_with_version. This method will be used by
ActionController::ConditionalGet to ensure that when collection cache versioning
is enabled, requests using ConditionalGet don't return the same ETag header
after a collection is modified. Fixes #38078 .
*Aaron Lipman*
2019-10-03 08:40:49 -04:00
* Skip test database when running `db:create` or `db:drop` in development
with `DATABASE_URL` set.
*Brian Buchalter*
2019-12-31 07:15:15 -05:00
* Don't allow mutations on the database configurations hash.
2019-12-19 12:25:39 -05:00
2019-12-31 07:15:15 -05:00
Freeze the configurations hash to disallow directly changing it. If applications need to change the hash, for example to create databases for parallelization, they should use the `DatabaseConfig` object directly.
2019-12-19 12:25:39 -05:00
Before:
```ruby
@db_config = ActiveRecord::Base.configurations.configs_for(env_name: "test", spec_name: "primary")
@db_config .configuration_hash.merge!(idle_timeout: "0.02")
```
After:
```ruby
@db_config = ActiveRecord::Base.configurations.configs_for(env_name: "test", spec_name: "primary")
config = @db_config .configuration_hash.merge(idle_timeout: "0.02")
db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(@db_config.env_name, @db_config .spec_name, config)
```
*Eileen M. Uchitelle* , *John Crepezzi*
2019-12-17 19:16:21 -05:00
* Remove `:connection_id` from the `sql.active_record` notification.
*Aaron Patterson* , *Rafael Mendonça França*
2019-12-17 12:59:30 -05:00
* The `:name` key will no longer be returned as part of `DatabaseConfig#configuration_hash` . Please use `DatabaseConfig#owner_name` instead.
*Eileen M. Uchitelle* , *John Crepezzi*
2019-12-17 12:07:29 -05:00
* ActiveRecord's `belongs_to_required_by_default` flag can now be set per model.
You can now opt-out/opt-in specific models from having their associations required
by default.
2019-12-17 12:59:30 -05:00
2019-12-17 12:07:29 -05:00
This change is meant to ease the process of migrating all your models to have
their association required.
*Edouard Chin*
2019-12-17 12:20:37 -05:00
* The `connection_config` method has been deprecated, please use `connection_db_config` instead which will return a `DatabaseConfigurations::DatabaseConfig` instead of a `Hash` .
*Eileen M. Uchitelle* , *John Crepezzi*
2019-02-09 17:58:36 -05:00
* Retain explicit selections on the base model after applying `includes` and `joins` .
Resolves #34889 .
*Patrick Rebsch*
2019-12-03 15:23:43 -05:00
* The `database` kwarg is deprecated without replacement because it can't be used for sharding and creates an issue if it's used during a request. Applications that need to create new connections should use `connects_to` instead.
*Eileen M. Uchitelle* , *John Crepezzi*
2019-11-13 17:35:28 -05:00
* Allow attributes to be fetched from Arel node groupings.
*Jeff Emminger* , *Gannon McGibbon*
2019-12-18 02:46:48 -05:00
* A database URL can now contain a querystring value that contains an equal sign. This is needed to support passing PostgreSQL `options` .
2019-11-17 11:04:36 -05:00
*Joshua Flanagan*
2019-11-11 16:17:54 -05:00
* Calling methods like `establish_connection` with a `Hash` which is invalid (eg: no `adapter` ) will now raise an error the same way as connections defined in `config/database.yml` .
*John Crepezzi*
2019-11-02 15:02:12 -04:00
* Specifying `implicit_order_column` now subsorts the records by primary key if available to ensure deterministic results.
*Paweł Urbanek*
2019-10-25 18:20:45 -04:00
* `where(attr => [])` now loads an empty result without making a query.
*John Hawthorn*
2019-10-12 12:45:27 -04:00
* Fixed the performance regression for `primary_keys` introduced MySQL 8.0.
*Hiroyuki Ishii*
2018-11-26 13:04:32 -05:00
* Add support for `belongs_to` to `has_many` inversing.
*Gannon McGibbon*
2019-04-09 15:40:16 -04:00
* Allow length configuration for `has_secure_token` method. The minimum length
is set at 24 characters.
Before:
```ruby
has_secure_token :auth_token
```
After:
```ruby
has_secure_token :default_token # 24 characters
has_secure_token :auth_token, length: 36 # 36 characters
has_secure_token :invalid_token, length: 12 # => ActiveRecord::SecureToken::MinimumLengthError
```
*Bernardo de Araujo*
2019-09-18 17:58:44 -04:00
* Deprecate `DatabaseConfigurations#to_h` . These connection hashes are still available via `ActiveRecord::Base.configurations.configs_for` .
*Eileen Uchitelle* , *John Crepezzi*
2019-09-12 13:10:57 -04:00
* Add `DatabaseConfig#configuration_hash` to return database configuration hashes with symbol keys, and use all symbol-key configuration hashes internally. Deprecate `DatabaseConfig#config` which returns a String-keyed `Hash` with the same values.
*John Crepezzi* , *Eileen Uchitelle*
2019-09-10 17:21:20 -04:00
* Allow column names to be passed to `remove_index` positionally along with other options.
Passing other options can be necessary to make `remove_index` correctly reversible.
Before:
add_index :reports, :report_id # => works
add_index :reports, :report_id, unique: true # => works
remove_index :reports, :report_id # => works
remove_index :reports, :report_id, unique: true # => ArgumentError
After:
remove_index :reports, :report_id, unique: true # => works
*Eugene Kenny*
2019-09-09 19:26:14 -04:00
* Allow bulk `ALTER` statements to drop and recreate indexes with the same name.
*Eugene Kenny*
2019-09-08 19:55:16 -04:00
* `insert` , `insert_all` , `upsert` , and `upsert_all` now clear the query cache.
*Eugene Kenny*
2019-08-29 09:00:36 -04:00
* Call `while_preventing_writes` directly from `connected_to` .
2019-08-28 08:26:45 -04:00
2019-08-29 09:00:36 -04:00
In some cases application authors want to use the database switching middleware and make explicit calls with `connected_to` . It's possible for an app to turn off writes and not turn them back on by the time we call `connected_to(role: :writing)` .
2019-08-28 08:26:45 -04:00
This change allows apps to fix this by assuming if a role is writing we want to allow writes, except in the case it's explicitly turned off.
*Eileen M. Uchitelle*
2019-08-14 06:51:04 -04:00
* Improve detection of ActiveRecord::StatementTimeout with mysql2 adapter in the edge case when the query is terminated during filesort.
*Kir Shatrov*
2019-08-06 17:10:25 -04:00
* Stop trying to read yaml file fixtures when loading Active Record fixtures.
*Gannon McGibbon*
2019-08-08 06:10:25 -04:00
* Deprecate `.reorder(nil)` with `.first` / `.first!` taking non-deterministic result.
To continue taking non-deterministic result, use `.take` / `.take!` instead.
*Ryuta Kamizono*
2019-08-02 16:30:10 -04:00
* Ensure custom PK types are casted in through reflection queries.
*Gannon McGibbon*
2019-07-29 13:37:26 -04:00
* Preserve user supplied joins order as much as possible.
Fixes #36761 , #34328 , #24281 , #12953 .
*Ryuta Kamizono*
2019-07-29 13:48:57 -04:00
* Allow `matches_regex` and `does_not_match_regexp` on the MySQL Arel visitor.
2019-07-29 07:04:07 -04:00
*James Pearson*
2019-07-29 13:48:57 -04:00
2019-05-18 08:58:22 -04:00
* Allow specifying fixtures to be ignored by setting `ignore` in YAML file's '_fixture' section.
*Tongfei Gao*
2019-07-26 00:49:38 -04:00
* Make the DATABASE_URL env variable only affect the primary connection. Add new env variables for multiple databases.
*John Crepezzi* , *Eileen Uchitelle*
2019-06-02 17:01:01 -04:00
* Add a warning for enum elements with 'not_' prefix.
class Foo
enum status: [:sent, :not_sent]
end
*Edu Depetris*
2019-11-23 19:20:00 -05:00
* Make currency symbols optional for money column type in PostgreSQL.
2019-07-12 14:49:03 -04:00
*Joel Schneider*
2019-07-17 01:18:54 -04:00
* Add support for beginless ranges, introduced in Ruby 2.7.
*Josh Goodall*
2019-06-10 16:22:29 -04:00
* Add database_exists? method to connection adapters to check if a database exists.
2019-07-08 15:53:55 -04:00
*Guilherme Mansur*
2019-06-10 16:22:29 -04:00
2019-05-14 15:13:29 -04:00
* Loading the schema for a model that has no `table_name` raises a `TableNotSpecified` error.
*Guilherme Mansur* , *Eugene Kenny*
2019-06-17 08:49:28 -04:00
* PostgreSQL: Fix GROUP BY with ORDER BY virtual count attribute.
Fixes #36022 .
*Ryuta Kamizono*
2019-06-13 14:23:13 -04:00
* Make ActiveRecord `ConnectionPool.connections` method thread-safe.
Fixes #36465 .
*Jeff Doering*
2019-06-07 14:13:18 -04:00
* Add support for multiple databases to `rails db:abort_if_pending_migrations` .
*Mark Lee*
2019-06-04 09:47:21 -04:00
* Fix sqlite3 collation parsing when using decimal columns.
*Martin R. Schuster*
2019-06-04 16:47:33 -04:00
* Fix invalid schema when primary key column has a comment.
2019-06-03 07:05:36 -04:00
2019-06-04 16:47:33 -04:00
Fixes #29966 .
2019-06-03 07:05:36 -04:00
*Guilherme Goettems Schneider*
2019-06-04 16:47:33 -04:00
* Fix table comment also being applied to the primary key column.
2019-05-31 15:59:47 -04:00
*Guilherme Goettems Schneider*
2019-05-13 01:39:16 -04:00
* Allow generated `create_table` migrations to include or skip timestamps.
2019-04-05 00:44:30 -04:00
2019-06-04 16:47:33 -04:00
*Michael Duchemin*
2019-08-08 06:10:25 -04:00
2019-04-24 15:57:14 -04:00
Please check [6-0-stable ](https://github.com/rails/rails/blob/6-0-stable/activerecord/CHANGELOG.md ) for previous changes.