activerecord 8.0.5.2 → 8.1.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +421 -662
- data/README.rdoc +1 -1
- data/lib/active_record/association_relation.rb +1 -1
- data/lib/active_record/associations/association.rb +1 -1
- data/lib/active_record/associations/belongs_to_association.rb +0 -2
- data/lib/active_record/associations/builder/association.rb +16 -5
- data/lib/active_record/associations/builder/belongs_to.rb +17 -4
- data/lib/active_record/associations/builder/collection_association.rb +7 -3
- data/lib/active_record/associations/builder/has_one.rb +1 -1
- data/lib/active_record/associations/builder/singular_association.rb +33 -5
- data/lib/active_record/associations/collection_proxy.rb +22 -4
- data/lib/active_record/associations/deprecation.rb +88 -0
- data/lib/active_record/associations/errors.rb +3 -0
- data/lib/active_record/associations/join_dependency.rb +4 -2
- data/lib/active_record/associations/preloader/batch.rb +1 -7
- data/lib/active_record/associations/preloader/branch.rb +1 -0
- data/lib/active_record/associations.rb +159 -21
- data/lib/active_record/attribute_methods/serialization.rb +16 -3
- data/lib/active_record/attribute_methods.rb +1 -1
- data/lib/active_record/attributes.rb +3 -0
- data/lib/active_record/autosave_association.rb +2 -2
- data/lib/active_record/base.rb +2 -3
- data/lib/active_record/coders/json.rb +14 -5
- data/lib/active_record/connection_adapters/abstract/connection_handler.rb +1 -3
- data/lib/active_record/connection_adapters/abstract/connection_pool/queue.rb +15 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb +51 -12
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +383 -52
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +27 -31
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +25 -18
- data/lib/active_record/connection_adapters/abstract/quoting.rb +15 -24
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +7 -2
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +26 -34
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +2 -1
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +88 -25
- data/lib/active_record/connection_adapters/abstract/transaction.rb +16 -3
- data/lib/active_record/connection_adapters/abstract_adapter.rb +96 -49
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +43 -11
- data/lib/active_record/connection_adapters/column.rb +17 -4
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +4 -4
- data/lib/active_record/connection_adapters/mysql/schema_creation.rb +2 -0
- data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +42 -5
- data/lib/active_record/connection_adapters/mysql/schema_statements.rb +26 -4
- data/lib/active_record/connection_adapters/mysql2/database_statements.rb +27 -22
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +1 -0
- data/lib/active_record/connection_adapters/postgresql/column.rb +2 -4
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +18 -23
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +21 -10
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +8 -21
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +65 -30
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +74 -38
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +10 -12
- data/lib/active_record/connection_adapters/schema_cache.rb +2 -2
- data/lib/active_record/connection_adapters/sqlite3/column.rb +2 -8
- data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +37 -25
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +0 -8
- data/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +3 -15
- data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +4 -13
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +57 -33
- data/lib/active_record/connection_adapters/trilogy/database_statements.rb +4 -3
- data/lib/active_record/connection_adapters/trilogy_adapter.rb +1 -1
- data/lib/active_record/connection_adapters.rb +1 -0
- data/lib/active_record/connection_handling.rb +8 -12
- data/lib/active_record/core.rb +5 -4
- data/lib/active_record/counter_cache.rb +33 -8
- data/lib/active_record/database_configurations/database_config.rb +5 -1
- data/lib/active_record/database_configurations/hash_config.rb +50 -9
- data/lib/active_record/database_configurations/url_config.rb +13 -3
- data/lib/active_record/database_configurations.rb +7 -3
- data/lib/active_record/delegated_type.rb +1 -1
- data/lib/active_record/dynamic_matchers.rb +54 -69
- data/lib/active_record/encryption/encryptable_record.rb +4 -4
- data/lib/active_record/encryption/encrypted_attribute_type.rb +1 -1
- data/lib/active_record/encryption/scheme.rb +1 -1
- data/lib/active_record/enum.rb +24 -8
- data/lib/active_record/errors.rb +23 -7
- data/lib/active_record/explain_registry.rb +0 -1
- data/lib/active_record/filter_attribute_handler.rb +73 -0
- data/lib/active_record/fixtures.rb +2 -2
- data/lib/active_record/future_result.rb +0 -2
- data/lib/active_record/gem_version.rb +3 -3
- data/lib/active_record/inheritance.rb +1 -1
- data/lib/active_record/insert_all.rb +14 -9
- data/lib/active_record/locking/optimistic.rb +7 -0
- data/lib/active_record/locking/pessimistic.rb +5 -0
- data/lib/active_record/log_subscriber.rb +1 -5
- data/lib/active_record/middleware/shard_selector.rb +34 -17
- data/lib/active_record/migration/command_recorder.rb +15 -2
- data/lib/active_record/migration/compatibility.rb +34 -24
- data/lib/active_record/migration/default_schema_versions_formatter.rb +30 -0
- data/lib/active_record/migration.rb +26 -16
- data/lib/active_record/model_schema.rb +10 -7
- data/lib/active_record/nested_attributes.rb +2 -0
- data/lib/active_record/persistence.rb +34 -3
- data/lib/active_record/query_cache.rb +22 -15
- data/lib/active_record/query_logs.rb +3 -7
- data/lib/active_record/railtie.rb +32 -3
- data/lib/active_record/railties/databases.rake +16 -4
- data/lib/active_record/railties/job_checkpoints.rb +15 -0
- data/lib/active_record/railties/job_runtime.rb +10 -11
- data/lib/active_record/reflection.rb +42 -3
- data/lib/active_record/relation/batches.rb +26 -12
- data/lib/active_record/relation/calculations.rb +20 -9
- data/lib/active_record/relation/delegation.rb +0 -1
- data/lib/active_record/relation/finder_methods.rb +28 -12
- data/lib/active_record/relation/merger.rb +2 -2
- data/lib/active_record/relation/predicate_builder/array_handler.rb +1 -3
- data/lib/active_record/relation/predicate_builder.rb +2 -2
- data/lib/active_record/relation/query_attribute.rb +3 -1
- data/lib/active_record/relation/query_methods.rb +40 -31
- data/lib/active_record/relation/where_clause.rb +2 -11
- data/lib/active_record/relation.rb +26 -14
- data/lib/active_record/result.rb +44 -21
- data/lib/active_record/sanitization.rb +2 -0
- data/lib/active_record/schema_dumper.rb +12 -10
- data/lib/active_record/scoping.rb +0 -1
- data/lib/active_record/signed_id.rb +43 -15
- data/lib/active_record/statement_cache.rb +13 -9
- data/lib/active_record/store.rb +44 -19
- data/lib/active_record/tasks/abstract_tasks.rb +76 -0
- data/lib/active_record/tasks/database_tasks.rb +2 -21
- data/lib/active_record/tasks/mysql_database_tasks.rb +3 -40
- data/lib/active_record/tasks/postgresql_database_tasks.rb +5 -39
- data/lib/active_record/tasks/sqlite_database_tasks.rb +14 -26
- data/lib/active_record/test_databases.rb +10 -2
- data/lib/active_record/test_fixtures.rb +27 -2
- data/lib/active_record/testing/query_assertions.rb +8 -2
- data/lib/active_record/timestamp.rb +4 -2
- data/lib/active_record/transaction.rb +2 -5
- data/lib/active_record/transactions.rb +32 -10
- data/lib/active_record/type/hash_lookup_type_map.rb +2 -1
- data/lib/active_record/type/internal/timezone.rb +7 -0
- data/lib/active_record/type/json.rb +15 -2
- data/lib/active_record/type/serialized.rb +11 -9
- data/lib/active_record/type/type_map.rb +1 -1
- data/lib/active_record/type_caster/connection.rb +2 -1
- data/lib/active_record/validations/associated.rb +1 -1
- data/lib/active_record.rb +65 -3
- data/lib/arel/alias_predication.rb +2 -0
- data/lib/arel/crud.rb +6 -11
- data/lib/arel/nodes/count.rb +2 -2
- data/lib/arel/nodes/function.rb +4 -10
- data/lib/arel/nodes/named_function.rb +2 -2
- data/lib/arel/nodes/node.rb +1 -1
- data/lib/arel/nodes.rb +0 -2
- data/lib/arel/predications.rb +3 -1
- data/lib/arel/select_manager.rb +7 -2
- data/lib/arel/visitors/dot.rb +0 -3
- data/lib/arel/visitors/postgresql.rb +55 -0
- data/lib/arel/visitors/sqlite.rb +55 -8
- data/lib/arel/visitors/to_sql.rb +3 -21
- data/lib/arel.rb +3 -1
- metadata +14 -10
- data/lib/active_record/normalization.rb +0 -163
data/CHANGELOG.md
CHANGED
|
@@ -1,199 +1,79 @@
|
|
|
1
|
-
## Rails 8.0.
|
|
1
|
+
## Rails 8.1.0.beta1 (September 04, 2025) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Remove deprecated `:unsigned_float` and `:unsigned_decimal` column methods for MySQL.
|
|
4
4
|
|
|
5
|
+
*Rafael Mendonça França*
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* No changes.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Rails 8.0.5 (March 24, 2026) ##
|
|
12
|
-
|
|
13
|
-
* Fix `insert_all` and `upsert_all` log message when called on anonymous classes.
|
|
14
|
-
|
|
15
|
-
*Gabriel Sobrinho*
|
|
16
|
-
|
|
17
|
-
* Respect `ActiveRecord::SchemaDumper.ignore_tables` when dumping SQLite virtual tables.
|
|
18
|
-
|
|
19
|
-
*Hans Schnedlitz*
|
|
20
|
-
|
|
21
|
-
* Restore previous instrumenter after `execute_or_skip`
|
|
22
|
-
|
|
23
|
-
`FutureResult#execute_or_skip` replaces the thread's instrumenter with an
|
|
24
|
-
`EventBuffer` to collect events published during async query execution.
|
|
25
|
-
If the global async executor is saturated and the `caller_runs` fallback
|
|
26
|
-
executes the task on the calling thread, we need to make sure the previous
|
|
27
|
-
instrumenter is restored or the stale `EventBuffer` would stay in place and
|
|
28
|
-
permanently swallow all subsequent `sql.active_record` notifications on
|
|
29
|
-
that thread.
|
|
30
|
-
|
|
31
|
-
*Rosa Gutierrez*
|
|
32
|
-
|
|
33
|
-
* Fix Ruby 4.0 delegator warning when calling inspect on ActiveRecord::Type::Serialized.
|
|
34
|
-
|
|
35
|
-
*Hammad Khan*
|
|
36
|
-
|
|
37
|
-
* Fix support for table names containing hyphens.
|
|
38
|
-
|
|
39
|
-
*Evgeniy Demin*
|
|
40
|
-
|
|
41
|
-
* Fix column deduplication for SQLite3 and PostgreSQL virtual (generated) columns.
|
|
42
|
-
|
|
43
|
-
`Column#==` and `Column#hash` now account for `virtual?` so that the
|
|
44
|
-
`Deduplicable` registry does not treat a generated column and a regular
|
|
45
|
-
column with the same name and type as identical. Previously, if a
|
|
46
|
-
generated column was registered first, a regular column on a different
|
|
47
|
-
table could be deduplicated to the generated instance, silently
|
|
48
|
-
excluding it from INSERT/UPDATE statements.
|
|
49
|
-
|
|
50
|
-
*Jay Huber*
|
|
51
|
-
|
|
52
|
-
* Fix merging relations with arel equality predicates with null relations.
|
|
53
|
-
|
|
54
|
-
*fatkodima*
|
|
55
|
-
|
|
56
|
-
* Fix SQLite3 schema dump for non-autoincrement integer primary keys.
|
|
57
|
-
|
|
58
|
-
Previously, `schema.rb` should incorrectly restore that table with an auto incrementing
|
|
59
|
-
primary key.
|
|
60
|
-
|
|
61
|
-
*Chris Hasiński*
|
|
62
|
-
|
|
63
|
-
* Fix PostgreSQL `schema_search_path` not being reapplied after `reset!` or `reconnect!`.
|
|
64
|
-
|
|
65
|
-
The `schema_search_path` configured in `database.yml` is now correctly
|
|
66
|
-
reapplied instead of falling back to PostgreSQL defaults.
|
|
67
|
-
|
|
68
|
-
*Tobias Egli*
|
|
69
|
-
|
|
70
|
-
* Ensure batched preloaded associations accounts for klass when grouping to avoid issues with STI.
|
|
71
|
-
|
|
72
|
-
*zzak*, *Stjepan Hadjic*
|
|
73
|
-
|
|
74
|
-
* Fix `ActiveRecord::SoleRecordExceeded#record` to return the relation.
|
|
75
|
-
|
|
76
|
-
This was the case until Rails 7.2, but starting from 8.0 it
|
|
77
|
-
started mistakenly returning the model class.
|
|
78
|
-
|
|
79
|
-
*Jean Boussier*
|
|
80
|
-
|
|
81
|
-
* Improve PostgreSQLAdapter resilience to Timeout.timeout.
|
|
82
|
-
|
|
83
|
-
Better handle asynchronous exceptions being thrown inside
|
|
84
|
-
the `reconnect!` method.
|
|
85
|
-
|
|
86
|
-
This may fixes some deep errors such as:
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
undefined method `key?' for nil:NilClass (NoMethodError)
|
|
90
|
-
if !type_map.key?(oid)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
*Jean Boussier*
|
|
94
|
-
|
|
95
|
-
* Fix `eager_load` when loading `has_many` assocations with composite primary keys.
|
|
96
|
-
|
|
97
|
-
This would result in some records being loaded multiple times.
|
|
98
|
-
|
|
99
|
-
*Martin-Alexander*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## Rails 8.0.4.1 (March 23, 2026) ##
|
|
103
|
-
|
|
104
|
-
* No changes.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
## Rails 8.0.4 (October 28, 2025) ##
|
|
108
|
-
|
|
109
|
-
* Fix SQLite3 data loss during table alterations with CASCADE foreign keys.
|
|
110
|
-
|
|
111
|
-
When altering a table in SQLite3 that is referenced by child tables with
|
|
112
|
-
`ON DELETE CASCADE` foreign keys, ActiveRecord would silently delete all
|
|
113
|
-
data from the child tables. This occurred because SQLite requires table
|
|
114
|
-
recreation for schema changes, and during this process the original table
|
|
115
|
-
is temporarily dropped, triggering CASCADE deletes on child tables.
|
|
116
|
-
|
|
117
|
-
The root cause was incorrect ordering of operations. The original code
|
|
118
|
-
wrapped `disable_referential_integrity` inside a transaction, but
|
|
119
|
-
`PRAGMA foreign_keys` cannot be modified inside a transaction in SQLite -
|
|
120
|
-
attempting to do so simply has no effect. This meant foreign keys remained
|
|
121
|
-
enabled during table recreation, causing CASCADE deletes to fire.
|
|
122
|
-
|
|
123
|
-
The fix reverses the order to follow the official SQLite 12-step ALTER TABLE
|
|
124
|
-
procedure: `disable_referential_integrity` now wraps the transaction instead
|
|
125
|
-
of being wrapped by it. This ensures foreign keys are properly disabled
|
|
126
|
-
before the transaction starts and re-enabled after it commits, preventing
|
|
127
|
-
CASCADE deletes while maintaining data integrity through atomic transactions.
|
|
128
|
-
|
|
129
|
-
*Ruy Rocha*
|
|
130
|
-
|
|
131
|
-
* Add support for bound SQL literals in CTEs.
|
|
132
|
-
|
|
133
|
-
*Nicolas Bachschmidt*
|
|
134
|
-
|
|
135
|
-
* Fix `belongs_to` associations not to clear the entire composite primary key.
|
|
136
|
-
|
|
137
|
-
When clearing a `belongs_to` association that references a model with composite primary key,
|
|
138
|
-
only the optional part of the key should be cleared.
|
|
139
|
-
|
|
140
|
-
*zzak*
|
|
141
|
-
|
|
142
|
-
* Fix invalid records being autosaved when distantly associated records are marked for deletion.
|
|
7
|
+
* Remove deprecated `:retries` option for the SQLite3 adapter.
|
|
143
8
|
|
|
144
|
-
*
|
|
9
|
+
*Rafael Mendonça França*
|
|
145
10
|
|
|
11
|
+
* Introduce new database configuration options `keepalive`, `max_age`, and
|
|
12
|
+
`min_connections` -- and rename `pool` to `max_connections` to match.
|
|
146
13
|
|
|
147
|
-
|
|
14
|
+
There are no changes to default behavior, but these allow for more specific
|
|
15
|
+
control over pool behavior.
|
|
148
16
|
|
|
149
|
-
*
|
|
17
|
+
*Matthew Draper*, *Chris AtLee*, *Rachael Wright-Munn*
|
|
150
18
|
|
|
151
|
-
|
|
152
|
-
for each thread.
|
|
19
|
+
* Move `LIMIT` validation from query generation to when `limit()` is called.
|
|
153
20
|
|
|
154
|
-
|
|
21
|
+
*Hartley McGuire*, *Shuyang*
|
|
155
22
|
|
|
156
|
-
|
|
23
|
+
* Add `ActiveRecord::CheckViolation` error class for check constraint violations.
|
|
157
24
|
|
|
158
|
-
*
|
|
25
|
+
*Ryuta Kamizono*
|
|
159
26
|
|
|
160
|
-
|
|
27
|
+
* Add `ActiveRecord::ExclusionViolation` error class for exclusion constraint violations.
|
|
161
28
|
|
|
162
|
-
|
|
29
|
+
When an exclusion constraint is violated in PostgreSQL, the error will now be raised
|
|
30
|
+
as `ActiveRecord::ExclusionViolation` instead of the generic `ActiveRecord::StatementInvalid`,
|
|
31
|
+
making it easier to handle these specific constraint violations in application code.
|
|
163
32
|
|
|
164
|
-
|
|
165
|
-
|
|
33
|
+
This follows the same pattern as other constraint violation error classes like
|
|
34
|
+
`RecordNotUnique` for unique constraint violations and `InvalidForeignKey` for
|
|
35
|
+
foreign key constraint violations.
|
|
166
36
|
|
|
167
|
-
*
|
|
37
|
+
*Ryuta Kamizono*
|
|
168
38
|
|
|
169
|
-
*
|
|
170
|
-
|
|
171
|
-
Rollback still runs, but may take longer.
|
|
39
|
+
* Attributes filtered by `filter_attributes` will now also be filtered by `filter_parameters`
|
|
40
|
+
so sensitive information is not leaked.
|
|
172
41
|
|
|
173
|
-
*
|
|
42
|
+
*Jill Klang*
|
|
174
43
|
|
|
175
|
-
*
|
|
44
|
+
* Add `connection.current_transaction.isolation` API to check current transaction's isolation level.
|
|
176
45
|
|
|
177
|
-
|
|
46
|
+
Returns the isolation level if it was explicitly set via the `isolation:` parameter
|
|
47
|
+
or through `ActiveRecord.with_transaction_isolation_level`, otherwise returns `nil`.
|
|
48
|
+
Nested transactions return the parent transaction's isolation level.
|
|
178
49
|
|
|
179
|
-
|
|
50
|
+
```ruby
|
|
51
|
+
# Returns nil when no transaction
|
|
52
|
+
User.connection.current_transaction.isolation # => nil
|
|
180
53
|
|
|
181
|
-
|
|
54
|
+
# Returns explicitly set isolation level
|
|
55
|
+
User.transaction(isolation: :serializable) do
|
|
56
|
+
User.connection.current_transaction.isolation # => :serializable
|
|
57
|
+
end
|
|
182
58
|
|
|
183
|
-
|
|
59
|
+
# Returns nil when isolation not explicitly set
|
|
60
|
+
User.transaction do
|
|
61
|
+
User.connection.current_transaction.isolation # => nil
|
|
62
|
+
end
|
|
184
63
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
64
|
+
# Nested transactions inherit parent's isolation
|
|
65
|
+
User.transaction(isolation: :read_committed) do
|
|
66
|
+
User.transaction do
|
|
67
|
+
User.connection.current_transaction.isolation # => :read_committed
|
|
68
|
+
end
|
|
69
|
+
end
|
|
188
70
|
```
|
|
189
71
|
|
|
190
|
-
|
|
72
|
+
*Kir Shatrov*
|
|
191
73
|
|
|
192
|
-
|
|
74
|
+
* Emit a warning for pg gem < 1.6.0 when using PostgreSQL 18+
|
|
193
75
|
|
|
194
|
-
*
|
|
195
|
-
|
|
196
|
-
*Jonathan Calvert*
|
|
76
|
+
*Yasuo Honda*
|
|
197
77
|
|
|
198
78
|
* Fix `#merge` with `#or` or `#and` and a mixture of attributes and SQL strings resulting in an incorrect query.
|
|
199
79
|
|
|
@@ -233,722 +113,601 @@
|
|
|
233
113
|
|
|
234
114
|
*Joshua Young*
|
|
235
115
|
|
|
236
|
-
*
|
|
237
|
-
|
|
238
|
-
*fatkodima*
|
|
239
|
-
|
|
240
|
-
* Fix migration log message for down operations.
|
|
241
|
-
|
|
242
|
-
*Bernardo Barreto*
|
|
243
|
-
|
|
244
|
-
* Prepend `extra_flags` in postgres' `structure_load`
|
|
245
|
-
|
|
246
|
-
When specifying `structure_load_flags` with a postgres adapter, the flags
|
|
247
|
-
were appended to the default flags, instead of prepended.
|
|
248
|
-
This caused issues with flags not being taken into account by postgres.
|
|
249
|
-
|
|
250
|
-
*Alice Loeser*
|
|
251
|
-
|
|
252
|
-
* Fix `annotate` comments to propagate to `update_all`/`delete_all`.
|
|
116
|
+
* Make schema dumper to account for `ActiveRecord.dump_schemas` when dumping in `:ruby` format.
|
|
253
117
|
|
|
254
118
|
*fatkodima*
|
|
255
119
|
|
|
256
|
-
*
|
|
257
|
-
loaded `has_and_belongs_to_many` association.
|
|
258
|
-
|
|
259
|
-
*Hartley McGuire*
|
|
260
|
-
|
|
261
|
-
* `create_or_find_by` will now correctly rollback a transaction.
|
|
262
|
-
|
|
263
|
-
When using `create_or_find_by`, raising a ActiveRecord::Rollback error
|
|
264
|
-
in a `after_save` callback had no effect, the transaction was committed
|
|
265
|
-
and a record created.
|
|
266
|
-
|
|
267
|
-
*Edouard Chin*
|
|
268
|
-
|
|
269
|
-
* Gracefully handle `Timeout.timeout` firing during connection configuration.
|
|
270
|
-
|
|
271
|
-
Use of `Timeout.timeout` could result in improperly initialized database connection.
|
|
272
|
-
|
|
273
|
-
This could lead to a partially configured connection being used, resulting in various exceptions,
|
|
274
|
-
the most common being with the PostgreSQLAdapter raising `undefined method 'key?' for nil`
|
|
275
|
-
or `TypeError: wrong argument type nil (expected PG::TypeMap)`.
|
|
276
|
-
|
|
277
|
-
*Jean Boussier*
|
|
278
|
-
|
|
279
|
-
* Fix stale state for composite foreign keys in belongs_to associations.
|
|
280
|
-
|
|
281
|
-
*Varun Sharma*
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
285
|
-
|
|
286
|
-
* Call inspect on ids in RecordNotFound error
|
|
287
|
-
|
|
288
|
-
[CVE-2025-55193]
|
|
289
|
-
|
|
290
|
-
*Gannon McGibbon*, *John Hawthorn*
|
|
120
|
+
* Add `:touch` option to `update_column`/`update_columns` methods.
|
|
291
121
|
|
|
122
|
+
```ruby
|
|
123
|
+
# Will update :updated_at/:updated_on alongside :nice column.
|
|
124
|
+
user.update_column(:nice, true, touch: true)
|
|
292
125
|
|
|
293
|
-
|
|
126
|
+
# Will update :updated_at/:updated_on alongside :last_ip column
|
|
127
|
+
user.update_columns(last_ip: request.remote_ip, touch: true)
|
|
128
|
+
```
|
|
294
129
|
|
|
295
|
-
*
|
|
130
|
+
*Dmitrii Ivliev*
|
|
296
131
|
|
|
297
|
-
|
|
132
|
+
* Optimize Active Record batching further when using ranges.
|
|
298
133
|
|
|
299
|
-
|
|
134
|
+
Tested on a PostgreSQL table with 10M records and batches of 10k records, the generation
|
|
135
|
+
of relations for the 1000 batches was `4.8x` faster (`6.8s` vs. `1.4s`), used `900x`
|
|
136
|
+
less bandwidth (`180MB` vs. `0.2MB`) and allocated `45x` less memory (`490MB` vs. `11MB`).
|
|
300
137
|
|
|
301
|
-
*
|
|
138
|
+
*Maxime Réty*, *fatkodima*
|
|
302
139
|
|
|
303
|
-
*
|
|
140
|
+
* Include current character length in error messages for index and table name length validations.
|
|
304
141
|
|
|
305
|
-
*
|
|
142
|
+
*Joshua Young*
|
|
306
143
|
|
|
307
|
-
*
|
|
144
|
+
* Add `rename_schema` method for PostgreSQL.
|
|
308
145
|
|
|
309
|
-
*
|
|
146
|
+
*T S Vallender*
|
|
310
147
|
|
|
311
|
-
*
|
|
148
|
+
* Implement support for deprecating associations:
|
|
312
149
|
|
|
313
|
-
|
|
150
|
+
```ruby
|
|
151
|
+
has_many :posts, deprecated: true
|
|
152
|
+
```
|
|
314
153
|
|
|
315
|
-
|
|
154
|
+
With that, Active Record will report any usage of the `posts` association.
|
|
316
155
|
|
|
317
|
-
|
|
156
|
+
Three reporting modes are supported (`:warn`, `:raise`, and `:notify`), and
|
|
157
|
+
backtraces can be enabled or disabled. Defaults are `:warn` mode and
|
|
158
|
+
disabled backtraces.
|
|
318
159
|
|
|
319
|
-
|
|
160
|
+
Please, check the docs for further details.
|
|
320
161
|
|
|
321
|
-
|
|
322
|
-
comparing it with the minimum required version for the adapter. This meant that the connection could
|
|
323
|
-
never be successfully configured on subsequent reconnection attempts.
|
|
324
|
-
|
|
325
|
-
Now, this is treated as a connection failure consistent with libpq, raising a `ActiveRecord::ConnectionFailed`
|
|
326
|
-
and ensuring the version isn't cached, which allows the version to be retrieved on the next connection attempt.
|
|
162
|
+
*Xavier Noria*
|
|
327
163
|
|
|
328
|
-
|
|
164
|
+
* PostgreSQL adapter create DB now supports `locale_provider` and `locale`.
|
|
329
165
|
|
|
330
|
-
*
|
|
166
|
+
*Bengt-Ove Hollaender*
|
|
331
167
|
|
|
332
|
-
|
|
333
|
-
This could lead to a partially configured connection being used, resulting in various exceptions,
|
|
334
|
-
the most common being with the PostgreSQLAdapter raising `undefined method `key?' for nil`
|
|
335
|
-
or `TypeError: wrong argument type nil (expected PG::TypeMap)`.
|
|
168
|
+
* Use ntuples to populate row_count instead of count for Postgres
|
|
336
169
|
|
|
337
|
-
*
|
|
170
|
+
*Jonathan Calvert*
|
|
338
171
|
|
|
339
|
-
* Fix
|
|
172
|
+
* Fix checking whether an unpersisted record is `include?`d in a strictly
|
|
173
|
+
loaded `has_and_belongs_to_many` association.
|
|
340
174
|
|
|
341
175
|
*Hartley McGuire*
|
|
342
176
|
|
|
343
|
-
*
|
|
177
|
+
* Add ability to change transaction isolation for all pools within a block.
|
|
344
178
|
|
|
345
|
-
|
|
179
|
+
This functionality is useful if your application needs to change the database
|
|
180
|
+
transaction isolation for a request or action.
|
|
346
181
|
|
|
347
|
-
|
|
182
|
+
Calling `ActiveRecord.with_transaction_isolation_level(level) {}` in an around filter or
|
|
183
|
+
middleware will set the transaction isolation for all pools accessed within the block,
|
|
184
|
+
but not for the pools that aren't.
|
|
348
185
|
|
|
349
|
-
|
|
350
|
-
development. Fixes #54343.
|
|
351
|
-
|
|
352
|
-
*Mike Dalessio*
|
|
353
|
-
|
|
354
|
-
* Fix SQL notifications sometimes not sent when using async queries.
|
|
186
|
+
This works with explicit and implicit transactions:
|
|
355
187
|
|
|
356
188
|
```ruby
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
189
|
+
ActiveRecord.with_transaction_isolation_level(:read_committed) do
|
|
190
|
+
Tag.transaction do # opens a transaction explicitly
|
|
191
|
+
Tag.create!
|
|
192
|
+
end
|
|
360
193
|
end
|
|
361
194
|
```
|
|
362
195
|
|
|
363
|
-
In rare circumstances and under the right race condition, Active Support notifications
|
|
364
|
-
would no longer be dispatched after using an asynchronous query.
|
|
365
|
-
This is now fixed.
|
|
366
|
-
|
|
367
|
-
*Edouard Chin*
|
|
368
|
-
|
|
369
|
-
* Fix support for PostgreSQL enum types with commas in their name.
|
|
370
|
-
|
|
371
|
-
*Arthur Hess*
|
|
372
|
-
|
|
373
|
-
* Fix inserts on MySQL with no RETURNING support for a table with multiple auto populated columns.
|
|
374
|
-
|
|
375
|
-
*Nikita Vasilevsky*
|
|
376
|
-
|
|
377
|
-
* Fix joining on a scoped association with string joins and bind parameters.
|
|
378
|
-
|
|
379
196
|
```ruby
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
end
|
|
383
|
-
|
|
384
|
-
class InstructorRole < ActiveRecord::Base
|
|
385
|
-
scope :active, -> {
|
|
386
|
-
joins("JOIN students ON instructor_roles.student_id = students.id")
|
|
387
|
-
.where(students { status: 1 })
|
|
388
|
-
}
|
|
197
|
+
ActiveRecord.with_transaction_isolation_level(:read_committed) do
|
|
198
|
+
Tag.create! # opens a transaction implicitly
|
|
389
199
|
end
|
|
390
|
-
|
|
391
|
-
Instructor.joins(:instructor_roles).first
|
|
392
200
|
```
|
|
393
201
|
|
|
394
|
-
|
|
395
|
-
`active` scope bind parameters would be lost.
|
|
396
|
-
|
|
397
|
-
*Jean Boussier*
|
|
398
|
-
|
|
399
|
-
* Fix a potential race condition with system tests and transactional fixtures.
|
|
400
|
-
|
|
401
|
-
*Sjoerd Lagarde*
|
|
202
|
+
*Eileen M. Uchitelle*
|
|
402
203
|
|
|
403
|
-
*
|
|
204
|
+
* Raise `ActiveRecord::MissingRequiredOrderError` when order dependent finder methods (e.g. `#first`, `#last`) are
|
|
205
|
+
called without `order` values on the relation, and the model does not have any order columns (`implicit_order_column`,
|
|
206
|
+
`query_constraints`, or `primary_key`) to fall back on.
|
|
404
207
|
|
|
405
|
-
|
|
406
|
-
|
|
208
|
+
This change will be introduced with a new framework default for Rails 8.1, and the current behavior of not raising
|
|
209
|
+
an error has been deprecated with the aim of removing the configuration option in Rails 8.2.
|
|
407
210
|
|
|
408
211
|
```ruby
|
|
409
|
-
|
|
212
|
+
config.active_record.raise_on_missing_required_finder_order_columns = true
|
|
410
213
|
```
|
|
411
214
|
|
|
412
|
-
*Jean Boussier*
|
|
413
|
-
|
|
414
|
-
* Remember when a database connection has recently been verified (for
|
|
415
|
-
two seconds, by default), to avoid repeated reverifications during a
|
|
416
|
-
single request.
|
|
417
|
-
|
|
418
|
-
This should recreate a similar rate of verification as in Rails 7.1,
|
|
419
|
-
where connections are leased for the duration of a request, and thus
|
|
420
|
-
only verified once.
|
|
421
|
-
|
|
422
|
-
*Matthew Draper*
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
## Rails 8.0.1 (December 13, 2024) ##
|
|
426
|
-
|
|
427
|
-
* Fix removing foreign keys with :restrict action for MySQL.
|
|
428
|
-
|
|
429
|
-
*fatkodima*
|
|
430
|
-
|
|
431
|
-
* Fix a race condition in `ActiveRecord::Base#method_missing` when lazily defining attributes.
|
|
432
|
-
|
|
433
|
-
If multiple thread were concurrently triggering attribute definition on the same model,
|
|
434
|
-
it could result in a `NoMethodError` being raised.
|
|
435
|
-
|
|
436
|
-
*Jean Boussier*
|
|
437
|
-
|
|
438
|
-
* Fix MySQL default functions getting dropped when changing a column's nullability.
|
|
439
|
-
|
|
440
|
-
*Bastian Bartmann*
|
|
441
|
-
|
|
442
|
-
* Fix `add_unique_constraint`/`add_check_constraint`/`add_foreign_key` to be revertible when given invalid options.
|
|
443
|
-
|
|
444
|
-
*fatkodima*
|
|
445
|
-
|
|
446
|
-
* Fix asynchronous destroying of polymorphic `belongs_to` associations.
|
|
447
|
-
|
|
448
|
-
*fatkodima*
|
|
449
|
-
|
|
450
|
-
* Fix `insert_all` to not update existing records.
|
|
451
|
-
|
|
452
|
-
*fatkodima*
|
|
453
|
-
|
|
454
|
-
* `NOT VALID` constraints should not dump in `create_table`.
|
|
455
|
-
|
|
456
|
-
*Ryuta Kamizono*
|
|
457
|
-
|
|
458
|
-
* Fix finding by nil composite primary key association.
|
|
459
|
-
|
|
460
|
-
*fatkodima*
|
|
461
|
-
|
|
462
|
-
* Properly reset composite primary key configuration when setting a primary key.
|
|
463
|
-
|
|
464
|
-
*fatkodima*
|
|
465
|
-
|
|
466
|
-
* Fix Mysql2Adapter support for prepared statements
|
|
467
|
-
|
|
468
|
-
Using prepared statements with MySQL could result in a `NoMethodError` exception.
|
|
469
|
-
|
|
470
|
-
*Jean Boussier*, *Leo Arnold*, *zzak*
|
|
471
|
-
|
|
472
|
-
* Fix parsing of SQLite foreign key names when they contain non-ASCII characters
|
|
473
|
-
|
|
474
|
-
*Zacharias Knudsen*
|
|
475
|
-
|
|
476
|
-
* Fix parsing of MySQL 8.0.16+ CHECK constraints when they contain new lines.
|
|
477
|
-
|
|
478
|
-
*Steve Hill*
|
|
479
|
-
|
|
480
|
-
* Ensure normalized attribute queries use `IS NULL` consistently for `nil` and normalized `nil` values.
|
|
481
|
-
|
|
482
215
|
*Joshua Young*
|
|
483
216
|
|
|
484
|
-
*
|
|
217
|
+
* `:class_name` is now invalid in polymorphic `belongs_to` associations.
|
|
485
218
|
|
|
486
|
-
`
|
|
219
|
+
Reason is `:class_name` does not make sense in those associations because
|
|
220
|
+
the class name of target records is dynamic and stored in the type column.
|
|
487
221
|
|
|
488
|
-
|
|
222
|
+
Existing polymorphic associations setting this option can just delete it.
|
|
223
|
+
While it did not raise, it had no effect anyway.
|
|
489
224
|
|
|
490
|
-
*
|
|
225
|
+
*Xavier Noria*
|
|
491
226
|
|
|
492
|
-
|
|
227
|
+
* Add support for multiple databases to `db:migrate:reset`.
|
|
493
228
|
|
|
229
|
+
*Joé Dupuis*
|
|
494
230
|
|
|
495
|
-
|
|
231
|
+
* Add `affected_rows` to `ActiveRecord::Result`.
|
|
496
232
|
|
|
497
|
-
*
|
|
233
|
+
*Jenny Shen*
|
|
498
234
|
|
|
235
|
+
* Enable passing retryable SqlLiterals to `#where`.
|
|
499
236
|
|
|
500
|
-
|
|
237
|
+
*Hartley McGuire*
|
|
501
238
|
|
|
502
|
-
*
|
|
239
|
+
* Set default for primary keys in `insert_all`/`upsert_all`.
|
|
503
240
|
|
|
504
|
-
|
|
241
|
+
Previously in Postgres, updating and inserting new records in one upsert wasn't possible
|
|
242
|
+
due to null primary key values. `nil` primary key values passed into `insert_all`/`upsert_all`
|
|
243
|
+
are now implicitly set to the default insert value specified by adapter.
|
|
505
244
|
|
|
506
|
-
*
|
|
245
|
+
*Jenny Shen*
|
|
507
246
|
|
|
247
|
+
* Add a load hook `active_record_database_configurations` for `ActiveRecord::DatabaseConfigurations`
|
|
508
248
|
|
|
509
|
-
|
|
249
|
+
*Mike Dalessio*
|
|
510
250
|
|
|
511
|
-
*
|
|
251
|
+
* Use `TRUE` and `FALSE` for SQLite queries with boolean columns.
|
|
512
252
|
|
|
513
|
-
*
|
|
253
|
+
*Hartley McGuire*
|
|
514
254
|
|
|
515
|
-
*
|
|
255
|
+
* Bump minimum supported SQLite to 3.23.0.
|
|
516
256
|
|
|
517
|
-
|
|
518
|
-
is created, leading to potential loss of data if a database is added to an
|
|
519
|
-
existing environment.
|
|
257
|
+
*Hartley McGuire*
|
|
520
258
|
|
|
521
|
-
|
|
522
|
-
are loaded during `db:prepare` which defaults to `true` for primary database
|
|
523
|
-
configs and `false` otherwise.
|
|
259
|
+
* Allow allocated Active Records to lookup associations.
|
|
524
260
|
|
|
525
|
-
|
|
261
|
+
Previously, the association cache isn't setup on allocated record objects, so association
|
|
262
|
+
lookups will crash. Test frameworks like mocha use allocate to check for stubbable instance
|
|
263
|
+
methods, which can trigger an association lookup.
|
|
526
264
|
|
|
527
|
-
*
|
|
265
|
+
*Gannon McGibbon*
|
|
528
266
|
|
|
529
|
-
*
|
|
267
|
+
* Encryption now supports `support_unencrypted_data: true` being set per-attribute.
|
|
530
268
|
|
|
531
|
-
|
|
269
|
+
Previously this only worked if `ActiveRecord::Encryption.config.support_unencrypted_data == true`.
|
|
270
|
+
Now, if the global config is turned off, you can still opt in for a specific attribute.
|
|
532
271
|
|
|
533
|
-
|
|
272
|
+
```ruby
|
|
273
|
+
# ActiveRecord::Encryption.config.support_unencrypted_data = true
|
|
274
|
+
class User < ActiveRecord::Base
|
|
275
|
+
encrypts :name, support_unencrypted_data: false # only supports encrypted data
|
|
276
|
+
encrypts :email # supports encrypted or unencrypted data
|
|
277
|
+
end
|
|
278
|
+
```
|
|
534
279
|
|
|
535
|
-
|
|
280
|
+
```ruby
|
|
281
|
+
# ActiveRecord::Encryption.config.support_unencrypted_data = false
|
|
282
|
+
class User < ActiveRecord::Base
|
|
283
|
+
encrypts :name, support_unencrypted_data: true # supports encrypted or unencrypted data
|
|
284
|
+
encrypts :email # only supports encrypted data
|
|
285
|
+
end
|
|
286
|
+
```
|
|
536
287
|
|
|
537
|
-
*
|
|
288
|
+
*Alex Ghiculescu*
|
|
538
289
|
|
|
539
|
-
|
|
290
|
+
* Model generator no longer needs a database connection to validate column types.
|
|
540
291
|
|
|
292
|
+
*Mike Dalessio*
|
|
541
293
|
|
|
542
|
-
|
|
294
|
+
* Allow signed ID verifiers to be configurable via `Rails.application.message_verifiers`
|
|
543
295
|
|
|
544
|
-
|
|
296
|
+
Prior to this change, the primary way to configure signed ID verifiers was
|
|
297
|
+
to set `signed_id_verifier` on each model class:
|
|
545
298
|
|
|
546
|
-
|
|
299
|
+
```ruby
|
|
300
|
+
Post.signed_id_verifier = ActiveSupport::MessageVerifier.new(...)
|
|
301
|
+
Comment.signed_id_verifier = ActiveSupport::MessageVerifier.new(...)
|
|
302
|
+
```
|
|
547
303
|
|
|
548
|
-
|
|
304
|
+
And if the developer did not set `signed_id_verifier`, a verifier would be
|
|
305
|
+
instantiated with a secret derived from `secret_key_base` and the following
|
|
306
|
+
options:
|
|
549
307
|
|
|
550
|
-
|
|
308
|
+
```ruby
|
|
309
|
+
{ digest: "SHA256", serializer: JSON, url_safe: true }
|
|
310
|
+
```
|
|
551
311
|
|
|
552
|
-
|
|
312
|
+
Thus it was cumbersome to rotate configuration for all verifiers.
|
|
553
313
|
|
|
554
|
-
|
|
314
|
+
This change defines a new Rails config: [`config.active_record.use_legacy_signed_id_verifier`][].
|
|
315
|
+
The default value is `:generate_and_verify`, which preserves the previous
|
|
316
|
+
behavior. However, when set to `:verify`, signed ID verifiers will use
|
|
317
|
+
configuration from `Rails.application.message_verifiers` (specifically,
|
|
318
|
+
`Rails.application.message_verifiers["active_record/signed_id"]`) to
|
|
319
|
+
generate and verify signed IDs, but will also verify signed IDs using the
|
|
320
|
+
older configuration.
|
|
555
321
|
|
|
556
|
-
|
|
322
|
+
To avoid complication, the new behavior only applies when `signed_id_verifier_secret`
|
|
323
|
+
is not set on a model class or any of its ancestors. Additionally,
|
|
324
|
+
`signed_id_verifier_secret` is now deprecated. If you are currently setting
|
|
325
|
+
`signed_id_verifier_secret` on a model class, you can set `signed_id_verifier`
|
|
326
|
+
instead:
|
|
557
327
|
|
|
558
|
-
|
|
328
|
+
```ruby
|
|
329
|
+
# BEFORE
|
|
330
|
+
Post.signed_id_verifier_secret = "my secret"
|
|
559
331
|
|
|
560
|
-
|
|
332
|
+
# AFTER
|
|
333
|
+
Post.signed_id_verifier = ActiveSupport::MessageVerifier.new("my secret", digest: "SHA256", serializer: JSON, url_safe: true)
|
|
334
|
+
```
|
|
561
335
|
|
|
562
|
-
|
|
336
|
+
To ease migration, `signed_id_verifier` has also been changed to behave as a
|
|
337
|
+
`class_attribute` (i.e. inheritable), but _only when `signed_id_verifier_secret`
|
|
338
|
+
is not set_:
|
|
563
339
|
|
|
564
|
-
|
|
340
|
+
```ruby
|
|
341
|
+
# BEFORE
|
|
342
|
+
ActiveRecord::Base.signed_id_verifier = ActiveSupport::MessageVerifier.new(...)
|
|
343
|
+
Post.signed_id_verifier == ActiveRecord::Base.signed_id_verifier # => false
|
|
565
344
|
|
|
566
|
-
|
|
345
|
+
# AFTER
|
|
346
|
+
ActiveRecord::Base.signed_id_verifier = ActiveSupport::MessageVerifier.new(...)
|
|
347
|
+
Post.signed_id_verifier == ActiveRecord::Base.signed_id_verifier # => true
|
|
567
348
|
|
|
568
|
-
|
|
349
|
+
Post.signed_id_verifier_secret = "my secret" # => deprecation warning
|
|
350
|
+
Post.signed_id_verifier == ActiveRecord::Base.signed_id_verifier # => false
|
|
351
|
+
```
|
|
569
352
|
|
|
570
|
-
|
|
353
|
+
Note, however, that it is recommended to eventually migrate from
|
|
354
|
+
model-specific verifiers to a unified configuration managed by
|
|
355
|
+
`Rails.application.message_verifiers`. `ActiveSupport::MessageVerifier#rotate`
|
|
356
|
+
can facilitate that transition. For example:
|
|
571
357
|
|
|
572
|
-
|
|
358
|
+
```ruby
|
|
359
|
+
# BEFORE
|
|
360
|
+
# Generate and verify signed Post IDs using Post-specific configuration
|
|
361
|
+
Post.signed_id_verifier = ActiveSupport::MessageVerifier.new("post secret", ...)
|
|
573
362
|
|
|
574
|
-
|
|
363
|
+
# AFTER
|
|
364
|
+
# Generate and verify signed Post IDs using the unified configuration
|
|
365
|
+
Post.signed_id_verifier = Post.signed_id_verifier.dup
|
|
366
|
+
# Fall back to Post-specific configuration when verifying signed IDs
|
|
367
|
+
Post.signed_id_verifier.rotate("post secret", ...)
|
|
368
|
+
```
|
|
575
369
|
|
|
576
|
-
|
|
370
|
+
[`config.active_record.use_legacy_signed_id_verifier`]: https://guides.rubyonrails.org/v8.1/configuring.html#config-active-record-use-legacy-signed-id-verifier
|
|
577
371
|
|
|
578
|
-
*
|
|
372
|
+
*Ali Sepehri*, *Jonathan Hefner*
|
|
579
373
|
|
|
580
|
-
*
|
|
374
|
+
* Prepend `extra_flags` in postgres' `structure_load`
|
|
581
375
|
|
|
582
|
-
|
|
376
|
+
When specifying `structure_load_flags` with a postgres adapter, the flags
|
|
377
|
+
were appended to the default flags, instead of prepended.
|
|
378
|
+
This caused issues with flags not being taken into account by postgres.
|
|
583
379
|
|
|
584
|
-
*
|
|
585
|
-
specified.
|
|
380
|
+
*Alice Loeser*
|
|
586
381
|
|
|
587
|
-
|
|
382
|
+
* Allow bypassing primary key/constraint addition in `implicit_order_column`
|
|
588
383
|
|
|
589
|
-
|
|
384
|
+
When specifying multiple columns in an array for `implicit_order_column`, adding
|
|
385
|
+
`nil` as the last element will prevent appending the primary key to order
|
|
386
|
+
conditions. This allows more precise control of indexes used by
|
|
387
|
+
generated queries. It should be noted that this feature does introduce the risk
|
|
388
|
+
of API misbehavior if the specified columns are not fully unique.
|
|
590
389
|
|
|
591
|
-
*
|
|
390
|
+
*Issy Long*
|
|
592
391
|
|
|
593
|
-
* Allow `
|
|
392
|
+
* Allow setting the `schema_format` via database configuration.
|
|
594
393
|
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
|
|
394
|
+
```
|
|
395
|
+
primary:
|
|
396
|
+
schema_format: ruby
|
|
598
397
|
```
|
|
599
398
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
* Make Float distinguish between `float4` and `float8` in PostgreSQL.
|
|
603
|
-
|
|
604
|
-
Fixes #52742
|
|
399
|
+
Useful for multi-database setups when apps require different formats per-database.
|
|
605
400
|
|
|
606
|
-
*
|
|
401
|
+
*T S Vallender*
|
|
607
402
|
|
|
403
|
+
* Support disabling indexes for MySQL v8.0.0+ and MariaDB v10.6.0+
|
|
608
404
|
|
|
609
|
-
|
|
405
|
+
MySQL 8.0.0 added an option to disable indexes from being used by the query
|
|
406
|
+
optimizer by making them "invisible". This allows the index to still be maintained
|
|
407
|
+
and updated but no queries will be permitted to use it. This can be useful for adding
|
|
408
|
+
new invisible indexes or making existing indexes invisible before dropping them
|
|
409
|
+
to ensure queries are not negatively affected.
|
|
410
|
+
See https://dev.mysql.com/blog-archive/mysql-8-0-invisible-indexes/ for more details.
|
|
610
411
|
|
|
611
|
-
|
|
412
|
+
MariaDB 10.6.0 also added support for this feature by allowing indexes to be "ignored"
|
|
413
|
+
in queries. See https://mariadb.com/kb/en/ignored-indexes/ for more details.
|
|
612
414
|
|
|
613
|
-
|
|
415
|
+
Active Record now supports this option for MySQL 8.0.0+ and MariaDB 10.6.0+ for
|
|
416
|
+
index creation and alteration where the new index option `enabled: true/false` can be
|
|
417
|
+
passed to column and index methods as below:
|
|
614
418
|
|
|
615
419
|
```ruby
|
|
616
|
-
|
|
420
|
+
add_index :users, :email, enabled: false
|
|
421
|
+
enable_index :users, :email
|
|
422
|
+
add_column :users, :dob, :string, index: { enabled: false }
|
|
423
|
+
|
|
424
|
+
change_table :users do |t|
|
|
425
|
+
t.index :name, enabled: false
|
|
426
|
+
t.index :dob
|
|
427
|
+
t.disable_index :dob
|
|
428
|
+
t.column :username, :string, index: { enabled: false }
|
|
429
|
+
t.references :account, index: { enabled: false }
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
create_table :users do |t|
|
|
433
|
+
t.string :name, index: { enabled: false }
|
|
434
|
+
t.string :email
|
|
435
|
+
t.index :email, enabled: false
|
|
436
|
+
end
|
|
617
437
|
```
|
|
618
438
|
|
|
619
|
-
*
|
|
439
|
+
*Merve Taner*
|
|
620
440
|
|
|
621
|
-
*
|
|
622
|
-
on the `add_enum_value` method.
|
|
441
|
+
* Respect `implicit_order_column` in `ActiveRecord::Relation#reverse_order`.
|
|
623
442
|
|
|
624
|
-
*
|
|
443
|
+
*Joshua Young*
|
|
625
444
|
|
|
626
|
-
*
|
|
445
|
+
* Add column types to `ActiveRecord::Result` for SQLite3.
|
|
627
446
|
|
|
628
|
-
*Andrew
|
|
447
|
+
*Andrew Kane*
|
|
629
448
|
|
|
630
|
-
*
|
|
631
|
-
the same child association but different parents does not join all parents.
|
|
449
|
+
* Raise `ActiveRecord::ReadOnlyError` when pessimistically locking with a readonly role.
|
|
632
450
|
|
|
633
|
-
|
|
451
|
+
*Joshua Young*
|
|
634
452
|
|
|
635
|
-
|
|
453
|
+
* Fix using the `SQLite3Adapter`'s `dbconsole` method outside of a Rails application.
|
|
636
454
|
|
|
637
|
-
|
|
455
|
+
*Hartley McGuire*
|
|
638
456
|
|
|
639
|
-
|
|
457
|
+
* Fix migrating multiple databases with `ActiveRecord::PendingMigration` action.
|
|
640
458
|
|
|
641
|
-
*
|
|
459
|
+
*Gannon McGibbon*
|
|
642
460
|
|
|
643
|
-
|
|
644
|
-
|
|
461
|
+
* Enable automatically retrying idempotent association queries on connection
|
|
462
|
+
errors.
|
|
645
463
|
|
|
646
|
-
|
|
464
|
+
*Hartley McGuire*
|
|
647
465
|
|
|
648
|
-
|
|
466
|
+
* Add `allow_retry` to `sql.active_record` instrumentation.
|
|
649
467
|
|
|
650
|
-
|
|
468
|
+
This enables identifying queries which queries are automatically retryable on connection errors.
|
|
651
469
|
|
|
652
|
-
|
|
653
|
-
which we have supported in the core. Now we support MySQL 5.6.4 or later, which
|
|
654
|
-
is the first version to support datetime with precision.
|
|
470
|
+
*Hartley McGuire*
|
|
655
471
|
|
|
656
|
-
|
|
472
|
+
* Better support UPDATE with JOIN for Postgresql and SQLite3
|
|
657
473
|
|
|
658
|
-
|
|
474
|
+
Previously when generating update queries with one or more JOIN clauses,
|
|
475
|
+
Active Record would use a sub query which would prevent to reference the joined
|
|
476
|
+
tables in the `SET` clause, for instance:
|
|
659
477
|
|
|
660
|
-
|
|
661
|
-
|
|
478
|
+
```ruby
|
|
479
|
+
Comment.joins(:post).update_all("title = posts.title")
|
|
480
|
+
```
|
|
662
481
|
|
|
663
|
-
|
|
664
|
-
|
|
482
|
+
This is now supported as long as the relation doesn't also use a `LIMIT`, `ORDER` or
|
|
483
|
+
`GROUP BY` clause. This was supported by the MySQL adapter for a long time.
|
|
665
484
|
|
|
666
485
|
*Jean Boussier*
|
|
667
486
|
|
|
668
|
-
*
|
|
669
|
-
|
|
670
|
-
This ensures that we call `PG::Connection.unescape_bytea` on PostgreSQL before decryption.
|
|
671
|
-
|
|
672
|
-
*Donal McBreen*
|
|
673
|
-
|
|
674
|
-
* Ensure `ActiveRecord::Encryption.config` is always ready before access.
|
|
675
|
-
|
|
676
|
-
Previously, `ActiveRecord::Encryption` configuration was deferred until `ActiveRecord::Base`
|
|
677
|
-
was loaded. Therefore, accessing `ActiveRecord::Encryption.config` properties before
|
|
678
|
-
`ActiveRecord::Base` was loaded would give incorrect results.
|
|
487
|
+
* Introduce a before-fork hook in `ActiveSupport::Testing::Parallelization` to clear existing
|
|
488
|
+
connections, to avoid fork-safety issues with the mysql2 adapter.
|
|
679
489
|
|
|
680
|
-
|
|
681
|
-
soon as needed.
|
|
490
|
+
Fixes #41776
|
|
682
491
|
|
|
683
|
-
|
|
684
|
-
`ActiveRecord::Encryption`, thus preserving the original behavior of having its config ready
|
|
685
|
-
before any use of `ActiveRecord::Base`.
|
|
492
|
+
*Mike Dalessio*, *Donal McBreen*
|
|
686
493
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
* Add `TimeZoneConverter#==` method, so objects will be properly compared by
|
|
690
|
-
their type, scale, limit & precision.
|
|
691
|
-
|
|
692
|
-
Address #52699.
|
|
693
|
-
|
|
694
|
-
*Ruy Rocha*
|
|
695
|
-
|
|
696
|
-
* Add support for SQLite3 full-text-search and other virtual tables.
|
|
697
|
-
|
|
698
|
-
Previously, adding sqlite3 virtual tables messed up `schema.rb`.
|
|
494
|
+
* PoolConfig no longer keeps a reference to the connection class.
|
|
699
495
|
|
|
700
|
-
|
|
496
|
+
Keeping a reference to the class caused subtle issues when combined with reloading in
|
|
497
|
+
development. Fixes #54343.
|
|
701
498
|
|
|
702
|
-
*
|
|
499
|
+
*Mike Dalessio*
|
|
703
500
|
|
|
704
|
-
*
|
|
501
|
+
* Fix SQL notifications sometimes not sent when using async queries.
|
|
705
502
|
|
|
706
503
|
```ruby
|
|
707
|
-
|
|
708
|
-
|
|
504
|
+
Post.async_count
|
|
505
|
+
ActiveSupport::Notifications.subscribed(->(*) { "Will never reach here" }) do
|
|
506
|
+
Post.count
|
|
709
507
|
end
|
|
710
508
|
```
|
|
711
509
|
|
|
712
|
-
|
|
510
|
+
In rare circumstances and under the right race condition, Active Support notifications
|
|
511
|
+
would no longer be dispatched after using an asynchronous query.
|
|
512
|
+
This is now fixed.
|
|
713
513
|
|
|
714
|
-
*
|
|
514
|
+
*Edouard Chin*
|
|
715
515
|
|
|
716
|
-
|
|
516
|
+
* Eliminate queries loading dumped schema cache on Postgres
|
|
717
517
|
|
|
718
|
-
|
|
518
|
+
Improve resiliency by avoiding needing to open a database connection to load the
|
|
519
|
+
type map while defining attribute methods at boot when a schema cache file is
|
|
520
|
+
configured on PostgreSQL databases.
|
|
719
521
|
|
|
720
|
-
|
|
721
|
-
with `:x` and `:y` keys of numeric values, mirroring the functionality of
|
|
722
|
-
existing casts for string and array values. Both string and symbol keys are
|
|
723
|
-
supported.
|
|
522
|
+
*James Coleman*
|
|
724
523
|
|
|
725
|
-
|
|
726
|
-
class PostgresqlPoint < ActiveRecord::Base
|
|
727
|
-
attribute :x, :point
|
|
728
|
-
attribute :y, :point
|
|
729
|
-
attribute :z, :point
|
|
730
|
-
end
|
|
524
|
+
* `ActiveRecord::Coder::JSON` can be instantiated
|
|
731
525
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
z: {x: '12.34', y: -43.21}
|
|
736
|
-
})
|
|
737
|
-
ActiveRecord::Point.new(12.32, -43.21) == val.x == val.y == val.z
|
|
526
|
+
Options can now be passed to `ActiveRecord::Coder::JSON` when instantiating the coder. This allows:
|
|
527
|
+
```ruby
|
|
528
|
+
serialize :config, coder: ActiveRecord::Coder::JSON.new(symbolize_names: true)
|
|
738
529
|
```
|
|
530
|
+
*matthaigh27*
|
|
739
531
|
|
|
740
|
-
|
|
532
|
+
* Deprecate using `insert_all`/`upsert_all` with unpersisted records in associations.
|
|
741
533
|
|
|
742
|
-
|
|
534
|
+
Using these methods on associations containing unpersisted records will now
|
|
535
|
+
show a deprecation warning, as the unpersisted records will be lost after
|
|
536
|
+
the operation.
|
|
743
537
|
|
|
744
|
-
|
|
538
|
+
*Nick Schwaderer*
|
|
745
539
|
|
|
746
|
-
|
|
540
|
+
* Make column name optional for `index_exists?`.
|
|
747
541
|
|
|
748
|
-
|
|
542
|
+
This aligns well with `remove_index` signature as well, where
|
|
543
|
+
index name doesn't need to be derived from the column names.
|
|
749
544
|
|
|
750
|
-
*
|
|
545
|
+
*Ali Ismayiliov*
|
|
751
546
|
|
|
752
|
-
*
|
|
547
|
+
* Change the payload name of `sql.active_record` notification for eager
|
|
548
|
+
loading from "SQL" to "#{model.name} Eager Load".
|
|
753
549
|
|
|
754
|
-
|
|
755
|
-
`enable_extension` statements if they differ from the current schema.
|
|
550
|
+
*zzak*
|
|
756
551
|
|
|
757
|
-
|
|
552
|
+
* Enable automatically retrying idempotent `#exists?` queries on connection
|
|
553
|
+
errors.
|
|
758
554
|
|
|
759
|
-
|
|
760
|
-
enable_extension "heroku_ext.pgcrypto"
|
|
761
|
-
enable_extension "pg_stat_statements"
|
|
762
|
-
```
|
|
555
|
+
*Hartley McGuire*, *classidied*
|
|
763
556
|
|
|
764
|
-
|
|
557
|
+
* Deprecate usage of unsupported methods in conjunction with `update_all`:
|
|
765
558
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
```
|
|
559
|
+
`update_all` will now print a deprecation message if a query includes either `WITH`,
|
|
560
|
+
`WITH RECURSIVE` or `DISTINCT` statements. Those were never supported and were ignored
|
|
561
|
+
when generating the SQL query.
|
|
770
562
|
|
|
771
|
-
|
|
563
|
+
An error will be raised in a future Rails release. This behavior will be consistent
|
|
564
|
+
with `delete_all` which currently raises an error for unsupported statements.
|
|
772
565
|
|
|
773
|
-
*
|
|
774
|
-
actual cast type.
|
|
566
|
+
*Edouard Chin*
|
|
775
567
|
|
|
776
|
-
|
|
568
|
+
* The table columns inside `schema.rb` are now sorted alphabetically.
|
|
777
569
|
|
|
778
|
-
|
|
570
|
+
Previously they'd be sorted by creation order, which can cause merge conflicts when two
|
|
571
|
+
branches modify the same table concurrently.
|
|
779
572
|
|
|
780
|
-
|
|
781
|
-
aggregated in a single bulk insert command.
|
|
573
|
+
*John Duff*
|
|
782
574
|
|
|
783
|
-
|
|
575
|
+
* Introduce versions formatter for the schema dumper.
|
|
784
576
|
|
|
785
|
-
|
|
577
|
+
It is now possible to override how schema dumper formats versions information inside the
|
|
578
|
+
`structure.sql` file. Currently, the versions are simply sorted in the decreasing order.
|
|
579
|
+
Within large teams, this can potentially cause many merge conflicts near the top of the list.
|
|
786
580
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
actually take a schema name (unlike `CREATE EXTENSION`), so the resulting SQL statement will only name
|
|
790
|
-
the extension, e.g. `DROP EXTENSION IF EXISTS "pgcrypto"`.
|
|
581
|
+
Now, the custom formatter can be provided with a custom sorting logic (e.g. by hash values
|
|
582
|
+
of the versions), which can greatly reduce the number of conflicts.
|
|
791
583
|
|
|
792
|
-
*
|
|
584
|
+
*fatkodima*
|
|
793
585
|
|
|
794
|
-
*
|
|
586
|
+
* Serialized attributes can now be marked as comparable.
|
|
795
587
|
|
|
796
|
-
|
|
588
|
+
A not rare issue when working with serialized attributes is that the serialized representation of an object
|
|
589
|
+
can change over time. Either because you are migrating from one serializer to the other (e.g. YAML to JSON or to msgpack),
|
|
590
|
+
or because the serializer used subtly changed its output.
|
|
797
591
|
|
|
798
|
-
|
|
592
|
+
One example is libyaml that used to have some extra trailing whitespaces, and recently fixed that.
|
|
593
|
+
When this sorts of thing happen, you end up with lots of records that report being changed even though
|
|
594
|
+
they aren't, which in the best case leads to a lot more writes to the database and in the worst case lead to nasty bugs.
|
|
799
595
|
|
|
800
|
-
|
|
596
|
+
The solution is to instead compare the deserialized representation of the object, however Active Record
|
|
597
|
+
can't assume the deserialized object has a working `==` method. Hence why this new functionality is opt-in.
|
|
801
598
|
|
|
802
599
|
```ruby
|
|
803
|
-
|
|
804
|
-
# do something with relation
|
|
805
|
-
end
|
|
600
|
+
serialize :config, type: Hash, coder: JSON, comparable: true
|
|
806
601
|
```
|
|
807
602
|
|
|
808
|
-
*
|
|
809
|
-
|
|
810
|
-
* Use SQLite `IMMEDIATE` transactions when possible.
|
|
811
|
-
|
|
812
|
-
Transactions run against the SQLite3 adapter default to IMMEDIATE mode to improve concurrency support and avoid busy exceptions.
|
|
813
|
-
|
|
814
|
-
*Stephen Margheim*
|
|
815
|
-
|
|
816
|
-
* Raise specific exception when a connection is not defined.
|
|
817
|
-
|
|
818
|
-
The new `ConnectionNotDefined` exception provides connection name, shard and role accessors indicating the details of the connection that was requested.
|
|
819
|
-
|
|
820
|
-
*Hana Harencarova*, *Matthew Draper*
|
|
603
|
+
*Jean Boussier*
|
|
821
604
|
|
|
822
|
-
*
|
|
605
|
+
* Fix MySQL default functions getting dropped when changing a column's nullability.
|
|
823
606
|
|
|
824
|
-
*
|
|
607
|
+
*Bastian Bartmann*
|
|
825
608
|
|
|
826
|
-
*
|
|
609
|
+
* SQLite extensions can be configured in `config/database.yml`.
|
|
827
610
|
|
|
828
|
-
|
|
829
|
-
|
|
611
|
+
The database configuration option `extensions:` allows an application to load SQLite extensions
|
|
612
|
+
when using `sqlite3` >= v2.4.0. The array members may be filesystem paths or the names of
|
|
613
|
+
modules that respond to `.to_path`:
|
|
830
614
|
|
|
831
|
-
|
|
615
|
+
``` yaml
|
|
616
|
+
development:
|
|
617
|
+
adapter: sqlite3
|
|
618
|
+
extensions:
|
|
619
|
+
- SQLean::UUID # module name responding to `.to_path`
|
|
620
|
+
- .sqlpkg/nalgeon/crypto/crypto.so # or a filesystem path
|
|
621
|
+
- <%= AppExtensions.location %> # or ruby code returning a path
|
|
622
|
+
```
|
|
832
623
|
|
|
833
|
-
*
|
|
624
|
+
*Mike Dalessio*
|
|
834
625
|
|
|
835
|
-
* `ActiveRecord::
|
|
626
|
+
* `ActiveRecord::Middleware::ShardSelector` supports granular database connection switching.
|
|
836
627
|
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
end
|
|
628
|
+
A new configuration option, `class_name:`, is introduced to
|
|
629
|
+
`config.active_record.shard_selector` to allow an application to specify the abstract connection
|
|
630
|
+
class to be switched by the shard selection middleware. The default class is
|
|
631
|
+
`ActiveRecord::Base`.
|
|
842
632
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
end
|
|
846
|
-
end
|
|
633
|
+
For example, this configuration tells `ShardSelector` to switch shards using
|
|
634
|
+
`AnimalsRecord.connected_to`:
|
|
847
635
|
|
|
848
|
-
class User
|
|
849
|
-
encrypts :name, compressor: ZstdCompressor
|
|
850
|
-
end
|
|
851
636
|
```
|
|
852
|
-
|
|
853
|
-
You disable compression by passing `compress: false`.
|
|
854
|
-
|
|
855
|
-
```ruby
|
|
856
|
-
class User
|
|
857
|
-
encrypts :name, compress: false
|
|
858
|
-
end
|
|
637
|
+
config.active_record.shard_selector = { class_name: "AnimalsRecord" }
|
|
859
638
|
```
|
|
860
639
|
|
|
861
|
-
*
|
|
862
|
-
|
|
863
|
-
* Add condensed `#inspect` for `ConnectionPool`, `AbstractAdapter`, and
|
|
864
|
-
`DatabaseConfig`.
|
|
865
|
-
|
|
866
|
-
*Hartley McGuire*
|
|
867
|
-
|
|
868
|
-
* Add `.shard_keys`, `.sharded?`, & `.connected_to_all_shards` methods.
|
|
869
|
-
|
|
870
|
-
```ruby
|
|
871
|
-
class ShardedBase < ActiveRecord::Base
|
|
872
|
-
self.abstract_class = true
|
|
873
|
-
|
|
874
|
-
connects_to shards: {
|
|
875
|
-
shard_one: { writing: :shard_one },
|
|
876
|
-
shard_two: { writing: :shard_two }
|
|
877
|
-
}
|
|
878
|
-
end
|
|
640
|
+
*Mike Dalessio*
|
|
879
641
|
|
|
880
|
-
|
|
881
|
-
end
|
|
642
|
+
* Reset relations after `insert_all`/`upsert_all`.
|
|
882
643
|
|
|
883
|
-
|
|
884
|
-
ShardedModel.sharded? => true
|
|
885
|
-
ShardedBase.connected_to_all_shards { ShardedModel.current_shard } => [:shard_one, :shard_two]
|
|
886
|
-
```
|
|
644
|
+
Bulk insert/upsert methods will now call `reset` if used on a relation, matching the behavior of `update_all`.
|
|
887
645
|
|
|
888
|
-
*
|
|
646
|
+
*Milo Winningham*
|
|
889
647
|
|
|
890
|
-
*
|
|
891
|
-
by these values.
|
|
648
|
+
* Use `_N` as a parallel tests databases suffixes
|
|
892
649
|
|
|
893
|
-
|
|
650
|
+
Peviously, `-N` was used as a suffix. This can cause problems for RDBMSes
|
|
651
|
+
which do not support dashes in database names.
|
|
894
652
|
|
|
895
|
-
*
|
|
896
|
-
for preloaded associations in models using composite primary keys.
|
|
897
|
-
|
|
898
|
-
*Jay Ang*
|
|
653
|
+
*fatkodima*
|
|
899
654
|
|
|
900
|
-
*
|
|
655
|
+
* Remember when a database connection has recently been verified (for
|
|
656
|
+
two seconds, by default), to avoid repeated reverifications during a
|
|
657
|
+
single request.
|
|
901
658
|
|
|
902
|
-
|
|
659
|
+
This should recreate a similar rate of verification as in Rails 7.1,
|
|
660
|
+
where connections are leased for the duration of a request, and thus
|
|
661
|
+
only verified once.
|
|
903
662
|
|
|
904
|
-
*
|
|
663
|
+
*Matthew Draper*
|
|
905
664
|
|
|
906
|
-
*
|
|
665
|
+
* Allow to reset cache counters for multiple records.
|
|
907
666
|
|
|
908
|
-
|
|
667
|
+
```
|
|
668
|
+
Aircraft.reset_counters([1, 2, 3], :wheels_count)
|
|
669
|
+
```
|
|
909
670
|
|
|
910
|
-
|
|
671
|
+
It produces much fewer queries compared to the custom implementation using looping over ids.
|
|
672
|
+
Previously: `O(ids.size * counters.size)` queries, now: `O(ids.size + counters.size)` queries.
|
|
911
673
|
|
|
912
|
-
*
|
|
913
|
-
structured (e.g., PostgreSQL +hstore+/+json+, or MySQL +json+) or declared serializable via
|
|
914
|
-
`ActiveRecord.store`.
|
|
674
|
+
*fatkodima*
|
|
915
675
|
|
|
916
|
-
|
|
676
|
+
* Add `affected_rows` to `sql.active_record` Notification.
|
|
917
677
|
|
|
918
|
-
|
|
678
|
+
*Hartley McGuire*
|
|
919
679
|
|
|
920
|
-
|
|
680
|
+
* Fix `sum` when performing a grouped calculation.
|
|
921
681
|
|
|
922
|
-
|
|
923
|
-
Please make sure the column is declared serializable via 'ActiveRecord.store' or, if your
|
|
924
|
-
database supports it, use a structured column type like hstore or json.
|
|
682
|
+
`User.group(:friendly).sum` no longer worked. This is fixed.
|
|
925
683
|
|
|
926
|
-
*
|
|
684
|
+
*Edouard Chin*
|
|
927
685
|
|
|
928
|
-
*
|
|
686
|
+
* Add support for enabling or disabling transactional tests per database.
|
|
929
687
|
|
|
930
|
-
|
|
688
|
+
A test class can now override the default `use_transactional_tests` setting
|
|
689
|
+
for individual databases, which can be useful if some databases need their
|
|
690
|
+
current state to be accessible to an external process while tests are running.
|
|
931
691
|
|
|
932
692
|
```ruby
|
|
933
|
-
class
|
|
934
|
-
|
|
693
|
+
class MostlyTransactionalTest < ActiveSupport::TestCase
|
|
694
|
+
self.use_transactional_tests = true
|
|
695
|
+
skip_transactional_tests_for_database :shared
|
|
935
696
|
end
|
|
936
697
|
```
|
|
937
698
|
|
|
938
|
-
|
|
699
|
+
*Matthew Cheetham*, *Morgan Mareve*
|
|
939
700
|
|
|
940
|
-
|
|
701
|
+
* Cast `query_cache` value when using URL configuration.
|
|
941
702
|
|
|
942
|
-
*
|
|
703
|
+
*zzak*
|
|
943
704
|
|
|
944
|
-
|
|
705
|
+
* NULLS NOT DISTINCT works with UNIQUE CONSTRAINT as well as UNIQUE INDEX.
|
|
945
706
|
|
|
946
|
-
|
|
947
|
-
ActiveRecord.schema_cache_ignored_tables = ["developers"]
|
|
948
|
-
ActiveRecord.schema_cache_ignored_table?("developers")
|
|
949
|
-
=> true
|
|
950
|
-
```
|
|
707
|
+
*Ryuta Kamizono*
|
|
951
708
|
|
|
952
|
-
|
|
709
|
+
* `PG::UnableToSend: no connection to the server` is now retryable as a connection-related exception
|
|
710
|
+
|
|
711
|
+
*Kazuma Watanabe*
|
|
953
712
|
|
|
954
|
-
Please check [
|
|
713
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activerecord/CHANGELOG.md) for previous changes.
|