| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ \ \
| | | |
| | | |
| | | | |
Cause ActiveRecord::Base::reload to also ignore the QueryCache.
|
| | | | |
|
|\ \ \ \
| |_|/ /
|/| | | |
If specify `strict: :default` explicitly, do not set sql_mode.
|
| | | |
| | | |
| | | |
| | | | |
Related with #17370.
|
|\ \ \ \
| |/ / /
|/| | |
| | | | |
Changed mysqldump to include sprocs and functions
|
| | |/
| |/| |
|
| | | |
|
| | |
| | |
| | |
| | | |
Was left in adfab2dcf4003ca564d78d4425566dd2d9cd8b4f
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| | |
See #9683 for the reasons we switched to `distinct`.
Here is the discussion that triggered the actual deprecation #20198.
`uniq`, `uniq!` and `uniq_value` are still around.
They will be removed in the next minor release after Rails 5.
|
|\ \
| | |
| | | |
Add schema cache to new connection pool after fork
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Active Record detects when the process has forked and automatically
creates a new connection pool to avoid sharing file descriptors.
If the existing connection pool had a schema cache associated with it,
the new pool should copy it to avoid unnecessarily querying the database
for its schema.
The code to detect that the process has forked is in ConnectionHandler,
but the existing test for it was in the ConnectionManagement test file.
I moved it to the right place while I was writing the new test for this
change.
|
|\ \ \
| | | |
| | | | |
Fix `serial?` with quoted sequence name
|
| |/ / |
|
|/ /
| |
| |
| |
| | |
We must account for receiving one less call to #new_connection, but the
test otherwise remains valid.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Renamed `@reserved_connections` -> `@thread_cached_conns`. New name
clearly conveys the purpose of the cache, which is to speed-up
`#connection` method.
The new `@thread_cached_conns` now also uses `Thread` objects as keys
(instead of previously `Thread.current.object_id`).
Since there is no longer any synchronization around
`@thread_cached_conns`, `disconnect!` and `clear_reloadable_connections!`
methods now pre-emptively obtain ownership (via `checkout`) of all
existing connections, before modifying internal data structures.
A private method `release` has been renamed `thread_conn_uncache` to
clear-up its purpose.
Fixed some brittle `thread.status == "sleep"` tests (threads can go
into sleep even without locks).
|
| | |
|
| |
| |
| |
| | |
Move post checkout connection verification out of mutex.synchronize.
|
|\ \
| | |
| | | |
remove redundant parenthesis
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This can resolve confusing situation when a top level constant exists
but a namespaced version is identified.
Related to #19531.
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
https://github.com/agrobbin/rails into agrobbin-sti-subclass-from-attributes
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
If your STI class looks like this:
```ruby
class Company < ActiveRecord::Base
self.store_full_sti_class = false
class GoodCo < Company
end
class BadCo < Company
end
end
```
The expectation (which is valid) is that the `type` in the database is saved as
`GoodCo` or `BadCo`. However, another expectation should be that setting `type`
to `GoodCo` would correctly instantiate the object as a `Company::GoodCo`. That
second expectation is what this should fix.
|
|/ / /
| | |
| | |
| | | |
db:structure dump and load
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The old `test_create_bang_returns_falsy_when_join_record_has_errors` had
a missleading name and was a duplicate of
`test_save_should_not_raise_exception_when_join_record_has_errors`.
Since it had an assertion on the return value I renamed it accordingly
and got rid of the duplicate test.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Make sure that tests do not hardcode the default value.
For example `test_instantiation_doesnt_try_to_require_corresponding_file`
always restored the configuration to `true` regardless of what it's
original value was.
Extract a helper to make the global modification consistent across tests.
|
|\ \ \
| | | |
| | | | |
Apply schema cache dump when creating connections
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The `db:schema:cache:dump` rake task dumps the database schema structure
to `db/schema_cache.dump`. If this file is present, the schema details
are loaded into the currently checked out connection by a railtie while
Rails is booting, to avoid having to query the database for its schema.
The schema cache dump is only applied to the initial connection used to
boot the application though; other connections from the same pool are
created with an empty schema cache, and still have to load the structure
of each table directly from the database.
With this change, a copy of the schema cache is associated with the
connection pool and applied to connections as they are created.
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | | |
Dump indexes in `create_table` instead of `add_index`
|
| | | |
| | | |
| | | |
| | | |
| | | | |
If the adapter supports indexes in create table, generated SQL is
slightly more efficient.
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
yuki24/change-record-not-saved-and-not-destroyed-to-include-error-msg
AR::RecordNotSaved & RecordNotDestroyed from save!/destroy! should include an error message
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | | |
When `AR::Base.save!` or `AR::Base.destroy!` is called and an exception
is raised, the exception doesn't have any error message or has a weird
message like `#<FailedBulb:0x0000000907b4b8>`. Give a better message so
we can easily understand why it's failing to save/destroy.
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Correctly dump `:options` on `create_table` for MySQL
|
| |/ / / |
|
|\ \ \ \
| | | | |
| | | | | |
Move PostgreSQL specific schema to postgresql_specific_schema.rb
|
| | |/ /
| |/| | |
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Example:
create_table :foos do |t|
t.string :string_en, collation: 'en_US.UTF-8'
t.text :text_ja, collation: 'ja_JP.UTF-8'
end
|
|/ / |
|
|\ \
| | |
| | |
| | | |
Fix unscope for less than
|
| | |
| | |
| | |
| | |
| | |
| | | |
Code such as the following will be corrected.
Developer.where(id: -Float::INFINITY...2).unscope(where: :id)
|
|\ \ \
| | | |
| | | |
| | | | |
Raise ArgumentError when find_by receives no arguments
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It fixes the strange error saying undefined method `take'.
```
RelationTest#test_find_by_without_arg_behaves_same_with_find_by({}):
NoMethodError: undefined method `take' for #<ActiveRecord::QueryMethods::WhereChain:0x007f9c55db1d68>
```
|
| |_|/
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Add a test-case to make sure that `create_table` with
a `foreign_key: true` and an adapter without foreign key support
does not blow up.
Motivated by #19794.
Originating from: https://github.com/rails/rails/commit/99a6f9e60ea55924b44f894a16f8de0162cf2702#commitcomment-10855210
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When running Active Record MySQL test, this warning is printed in the
console:
warning: instance variable errno not initialized
It turns out that this is a warning from `mysql` gem in MySQL::Error
object. However, since the `mysql` gem is no longer maintained, and
there won't be a newer version, it make sense for us to just silence
this warning to make the output cleaner.
|
|\ \ \
| | | |
| | | |
| | | | |
Fix missing index when using timestamps with index
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The `index` option used with `timestamps` should be passed to both
`column` definitions for `created_at` and `updated_at` rather than just
the first.
This was happening because `Hash#delete` is used to extract the `index`
option passed to `timestamps`, thereby mutating the `options` hash
in-place. Now take a copy of the `options` before deleting so that the
original is not modified.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In 1f006c an option was added called :class to allow passing anonymous
classes to association definitions. Since using :class instead of
:class_name is a fairly common typo even amongst experienced developers
this can result in hard to debug errors arising in raise_on_type_mismatch?
To fix this we're renaming the option from :class to :anonymous_class as
that is a more correct description of what the option is for. Since this
was an internal, undocumented option there is no need for a deprecation.
Fixes #19659
|
|\ \ \ \
| | | | |
| | | | | |
Raise StaleObjectError if touched object is stale and locking is enabled
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Fixes #19776
change test variable names and use more verbose on method
less verbose
use _read_attribute instead of send
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
To me it seems like this should only be the case if `autosave: true` is
set on the association. However, when implemented that way, it caused
issues with has many associations, where we have explicit tests stating
that child records are updated when the parent is new, even if autosave
is not set (presumably to update the parent id, but other changed
attributes would be persisted as well).
It's quirky, but at least we should be consistently quirky. This
constitutes a minor but subtle change in behavior, and therefore should
not be backported to 4.2 and earlier.
Fixes #19782
|