| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
indexes
|
| |
|
| |
|
|\
| |
| | |
Improve log messages for #insert_all` / `#upsert_all` etc. methods
|
| |
| |
| |
| |
| |
| |
| |
| | |
etc. methods
In #35077, `#insert_all` / `#upsert_all` / `#insert` / `#upsert` etc. methods are added. But Active Record logs only “Bulk Insert” log messages when they are invoked.
This commit improves the log messages to use collect words for how invoked them.
|
|/
|
|
|
|
|
|
|
|
|
| |
not specified
If `id` is an `AUTONUMBER` column, then my former strategy here of assigning `no_op_column` to an arbitrary column would fail in this specific scenario:
1. `model.columns.first` is an AUTONUMBER column
2. `model.columns.first` is not assigned in the insert attributes
I added three tests: the first test covers the actual error; the second test documents that this _isn't_ a problem when a value is given for the AUTONUMBER column and the third test ensures that this no-op strategy isn't secretly doing an UPSERT.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
I found `:unique_by` with `:columns` and `:where` inside it tough to
grasp. The documentation only mentioned indexes and partial indexes.
So why duplicate a model's indexes in an insert_all/upsert_all call
when we can just look it up?
This has the added benefit of raising if no index is found, such that
people can't insert thousands of records without relying on an index
of some form.
|
|
|
|
| |
This also prevents insert_all from leaking its attributes checks.
|
|
|
|
|
|
| |
`values_list` is quite long and does far too many things. This also
eagerly extract the keys in initialize instead of having to worry about
calling them multiple times.
|
|
|
|
| |
friends.
|
| |
|
| |
|
|
Adds a method to ActiveRecord allowing records to be inserted in bulk without instantiating ActiveRecord models. This method supports options for handling uniqueness violations by skipping duplicate records or overwriting them in an UPSERT operation.
ActiveRecord already supports bulk-update and bulk-destroy actions that execute SQL UPDATE and DELETE commands directly. It also supports bulk-read actions through `pluck`. It makes sense for it also to support bulk-creation.
|