| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
https://github.com/rails/rails/issues/31190
|
|\
| |
| |
| | |
SQLite3 adapter `alter_table` method restores foreign keys
|
| |
| |
| |
| | |
Related to #33520
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Move changelog entry of #33530 up in order to preserve the chronology
since we always add new entries on the top of a changelog file.
- Clarify the changelog entry
- Clarify the docs of remove_foreign_key
- Ensure reversible of `remove_foreign_key` with `:primary_key` and `:to_table`
options.
|
|/
|
|
|
|
|
|
|
|
|
|
| |
remove_foreign_key supports
- remove_foreign_key :accounts, :branches
- remove_foreign_key :accounts, to_table: :branches
but the second one is not reversible.
This branch is to fix and allow second one to be reversible.
[Nikolay Epifanov, Rich Chen]
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit d162188dd662a7d9f62ba8431474f50bc35e3e93, reversing
changes made to 3576782888c307e3e192c44e332b957cd1174128.
Reason: #24131 conflicts the #5153's default order contract, it means
that existing apps would be broken by that change.
We don't want to break existing apps without a deprecation cycle.
|
| |
|
| |
|
|\
| |
| |
| | |
Fix default value for mysql time types with specified precision
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The TIME, DATETIME, and TIMESTAMP types [have supported](https://mariadb.com/kb/en/library/microseconds-in-mariadb/)
a fractional seconds precision from 0 to 6.
Default values from time columns with specified precision is read
as `current_timestamp(n)` from information schema.
rake `db:schema:dump` produces `schema.rb` **without** default values for time columns with the specified precision:
t.datetime "last_message_at", precision: 6, null: false
rake `db:schema:dump` produces `schema.rb` **with** default values for time columns with the specified precision:
t.datetime "last_message_at", precision: 6, default: -> { "current_timestamp(6)" }, null: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`touch` option was added to `increment!` (#27660) and `update_counters`
(#26995). But that option behaves inconsistently with
`Persistence#touch` method.
If `touch` option is passed attribute names, it won't update
update_at/on attributes unlike `Persistence#touch` method.
Due to changed from `Persistence#touch` to `increment!` with `touch`
option, #31405 has a regression that `counter_cache` with `touch` option
which is passed attribute names won't update update_at/on attributes.
I think that the inconsistency is not intended. To get back consistency,
ensure that `touch` option updates update_at/on attributes.
|
|\
| |
| |
| | |
Allow prefix/suffix options for store accessors
|
| |
| |
| |
| | |
[ci skip]
|
| |
| |
| |
| | |
(same name).
|
| |
| |
| |
| | |
Related to #32923
|
|\ \
| |/
|/|
| | |
Fix parent record should not get saved with duplicate children records
|
|/
|
|
| |
- Fixes #32940
|
|
|
|
| |
Commit callbacks are intentionally disabled when errors occur when calling the callback chain in order to reset the internal record state. However, the implicit order of operations on the logic for checking if callbacks are disabled is wrong. The result is that callbacks can be unexpectedly when errors occur in transactions.
|
|
|
|
|
|
|
| |
Already loaded associations were running an extra query when `size` was called on the association.
This fix ensures that an extra query is no longer run.
Update tests to use proper methods
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Add a prefix option to ActiveRecord::Store.store_accessor and
ActiveRecord::Store.store. This option allows stores to have identical keys
with different accessors.
|
|
|
|
|
|
| |
We only add the header when releasing to avoid some conflicts.
[ci skip]
|
| |
|
|
|
|
| |
columsn ->
columns
|
|\
| |
| |
| | |
Use column alias of primary_key in limited_ids_for
|
|/
|
|
|
|
|
| |
Prevent `ActiveRecord::FinderMethods#limited_ids_for` from using correct primary
key values even if `ORDER BY` columns include other table's primary key.
Fixes #28364.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an alternative of #31877 to fix #31876 caused by #28808.
This issue was caused by a combination of several loose implementation.
* finding automatic inverse association of polymorphic without context (caused by #28808)
* returning `klass` even if `polymorphic?` (exists before #28808)
* loose verification by `valid_inverse_reflection?` (exists before #28808)
This makes `klass` raise if `polymorphic?` not to be misused.
This issue will not happen unless polymorphic `klass` is misused.
Fixes #31876.
Closes #31877.
|
| |
|
|
|
|
|
|
| |
Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug.
References #32028
|
|
|
|
| |
Closes #31998
|
|
|
| |
Add #create_or_find_by to lean on unique constraints
|
|
|
|
| |
:tada::tada::tada:
|
|
|
|
|
| |
This can not expand an array of aggregated objects correctly, and is no
longer used internally since 159b21b5.
|
|\
| |
| |
| | |
Fix not expanded problem when passing an Array object as argument to the where method using composed_of column.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
where method using composed_of column.
Fixes #31723
```
david_balance = customers(:david).balance
Customer.where(balance: [david_balance]).to_sql
# Before: WHERE `customers`.`balance` = NULL
# After : WHERE `customers`.`balance` = 50
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
driving table
This is a regression caused by 6beb4de.
In PostgreSQL, ORDER BY expressions must appear in SELECT list when
using DISTINCT.
When using `count(:all)` with eager loading, Active Record enforces
DISTINCT to count the driving table records only. 6beb4de was caused the
regression because `count(:all)` with DISTINCT path no longer removes
ORDER BY.
We need to ignore ORDER BY when DISTINCT is enforced, otherwise not
always generated valid SQL for PostgreSQL.
Fixes #31783.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Currently `object.save` will unfreeze the object, due to
`changes_applied` replaces frozen `@attributes` to new `@attributes`.
Since originally destroyed objects are not allowed to be mutated, `save`
and `save!` should not return success in that case.
Fixes #28563.
|
|\
| |
| |
| | |
When deleting through records, take into account association conditions
|
|\ \
| | |
| | |
| | |
| | |
| | | |
zoltankiss/allow-nested-has-many-associations-on-unpersisted-parent-instances
fix nested `has many :through` associations on unpersisted parent instances
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | | |
Use `count(:all)` in HasManyAssociation#count_records
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Problem: Calling `count` on an association can cause invalid SQL queries
to be created where the `SELECT COUNT(a, b, c)` function receives
multiple columns. This will cause a `StatementInvalid` exception later
on.
Solution: Use `count(:all)`, which generates a `SELECT COUNT(*)...`
query independently of the association.
This also includes a test case that, before the fix, broke.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
mikelikesbikes/fix-update-attribute-callbacks-issue
save attributes changed by callbacks after update_attribute
|