mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Squashed commit of the following:
commitfdb0b29ad9
Author: Rafael Mendonça França <rafael@rubyonrails.org> Date: Fri Dec 3 03:39:20 2021 +0000 Remove deprecated `config` in `dbconsole` commit25c4cf82cd
Author: Rafael Mendonça França <rafael@rubyonrails.org> Date: Fri Dec 3 02:35:07 2021 +0000 Remove deprecated `ActiveRecord::DatabaseConfigurations::DatabaseConfig#spec_name` commit887dc810d1
Author: Rafael Mendonça França <rafael@rubyonrails.org> Date: Fri Dec 3 02:27:54 2021 +0000 Remove deprecated `ActiveRecord::Connection#:in_clause_length` commit126319ec3d
Author: Rafael Mendonça França <rafael@rubyonrails.org> Date: Fri Dec 3 02:21:49 2021 +0000 Remove deprecated `ActiveRecord::Connection#allowed_index_name_length` commit60e9fd6106
Author: Rafael Mendonça França <rafael@rubyonrails.org> Date: Fri Nov 19 23:32:42 2021 +0000 Remove deprecated `ActiveRecord::Base#remove_connection` commit7b8546572e
Author: Rafael Mendonça França <rafael@rubyonrails.org> Date: Fri Nov 19 23:30:17 2021 +0000 Fix warnings and wrong indentation
This commit is contained in:
parent
2b6182cbd6
commit
b6bc552c1f
11 changed files with 41 additions and 77 deletions
|
@ -1,3 +1,19 @@
|
|||
* Remove deprecated `ActiveRecord::DatabaseConfigurations::DatabaseConfig#spec_name`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Remove deprecated `ActiveRecord::Connection#in_clause_length`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Remove deprecated `ActiveRecord::Connection#allowed_index_name_length`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Remove deprecated `ActiveRecord::Base#remove_connection`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Load STI Models in fixtures
|
||||
|
||||
Data from Fixtures now loads based on the specific class for models with
|
||||
|
@ -5,7 +21,7 @@
|
|||
the value of these fields was not parsed and remained `nil`
|
||||
|
||||
*Andres Howard*
|
||||
|
||||
|
||||
* `#authenticate` returns false when the password is blank instead of raising an error.
|
||||
|
||||
*Muhammad Muhammad Ibrahim*
|
||||
|
|
|
@ -218,15 +218,6 @@ module ActiveRecord
|
|||
pool && pool.connected?
|
||||
end
|
||||
|
||||
# Remove the connection for this class. This will close the active
|
||||
# connection and the defined connection (if they exist). The result
|
||||
# can be used as an argument for #establish_connection, for easily
|
||||
# re-establishing the connection.
|
||||
def remove_connection(owner, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
|
||||
remove_connection_pool(owner, role: role, shard: shard)&.configuration_hash
|
||||
end
|
||||
deprecate remove_connection: "Use #remove_connection_pool, which now returns a DatabaseConfig object instead of a Hash"
|
||||
|
||||
def remove_connection_pool(owner, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
|
||||
if pool_manager = get_pool_manager(owner)
|
||||
pool_config = pool_manager.remove_pool_config(role, shard)
|
||||
|
|
|
@ -12,28 +12,11 @@ module ActiveRecord
|
|||
max_identifier_length
|
||||
end
|
||||
|
||||
# Returns the maximum allowed length for an index name. This
|
||||
# limit is enforced by \Rails and is less than or equal to
|
||||
# #index_name_length. The gap between
|
||||
# #index_name_length is to allow internal \Rails
|
||||
# operations to use prefixes in temporary operations.
|
||||
def allowed_index_name_length
|
||||
index_name_length
|
||||
end
|
||||
deprecate :allowed_index_name_length
|
||||
|
||||
# Returns the maximum length of an index name.
|
||||
def index_name_length
|
||||
max_identifier_length
|
||||
end
|
||||
|
||||
# Returns the maximum number of elements in an IN (x,y,z) clause.
|
||||
# +nil+ means no limit.
|
||||
def in_clause_length
|
||||
nil
|
||||
end
|
||||
deprecate :in_clause_length
|
||||
|
||||
private
|
||||
def bind_params_length
|
||||
65535
|
||||
|
|
|
@ -15,11 +15,6 @@ module ActiveRecord
|
|||
@name = name
|
||||
end
|
||||
|
||||
def spec_name
|
||||
@name
|
||||
end
|
||||
deprecate spec_name: "please use name instead"
|
||||
|
||||
def adapter_method
|
||||
"#{adapter}_connection"
|
||||
end
|
||||
|
|
|
@ -300,16 +300,6 @@ module ActiveRecord
|
|||
test "type_to_sql returns a String for unmapped types" do
|
||||
assert_equal "special_db_type", @connection.type_to_sql(:special_db_type)
|
||||
end
|
||||
|
||||
def test_allowed_index_name_length_is_deprecated
|
||||
assert_deprecated { @connection.allowed_index_name_length }
|
||||
end
|
||||
|
||||
unless current_adapter?(:OracleAdapter)
|
||||
def test_in_clause_length_is_deprecated
|
||||
assert_deprecated { @connection.in_clause_length }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class AdapterForeignKeyTest < ActiveRecord::TestCase
|
||||
|
|
|
@ -283,18 +283,18 @@ if ActiveRecord::Base.connection.prepared_statements
|
|||
|
||||
def assert_filtered_log_binds(binds)
|
||||
payload = {
|
||||
name: "SQL",
|
||||
sql: "select * from users where auth_token = ?",
|
||||
binds: binds,
|
||||
type_casted_binds: @connection.send(:type_casted_binds, binds)
|
||||
name: "SQL",
|
||||
sql: "select * from users where auth_token = ?",
|
||||
binds: binds,
|
||||
type_casted_binds: @connection.send(:type_casted_binds, binds)
|
||||
}
|
||||
|
||||
event = ActiveSupport::Notifications::Event.new(
|
||||
"foo",
|
||||
Time.now,
|
||||
Time.now,
|
||||
123,
|
||||
payload)
|
||||
"foo",
|
||||
Time.now,
|
||||
Time.now,
|
||||
123,
|
||||
payload)
|
||||
|
||||
logger = Class.new(ActiveRecord::LogSubscriber) {
|
||||
attr_reader :debugs
|
||||
|
|
|
@ -148,18 +148,6 @@ module ActiveRecord
|
|||
ENV["RAILS_ENV"] = previous_env
|
||||
ActiveRecord::Base.establish_connection(:arunit)
|
||||
end
|
||||
|
||||
def test_remove_connection_is_deprecated
|
||||
expected = @handler.retrieve_connection_pool(@owner_name).db_config.configuration_hash
|
||||
|
||||
config_hash = assert_deprecated do
|
||||
@handler.remove_connection(@owner_name)
|
||||
end
|
||||
|
||||
assert_equal expected, config_hash
|
||||
ensure
|
||||
ActiveRecord::Base.establish_connection(:arunit)
|
||||
end
|
||||
end
|
||||
|
||||
def test_establish_connection_using_two_level_configurations
|
||||
|
|
|
@ -94,14 +94,6 @@ class LegacyDatabaseConfigurationsTest < ActiveRecord::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_spec_name_getter_is_deprecated
|
||||
db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary")
|
||||
|
||||
assert_deprecated do
|
||||
assert_equal "primary", db_config.spec_name
|
||||
end
|
||||
end
|
||||
|
||||
def test_hidden_returns_replicas
|
||||
config = {
|
||||
"default_env" => {
|
||||
|
|
|
@ -30,6 +30,8 @@ Please refer to the [Changelog][railties] for detailed changes.
|
|||
|
||||
### Removals
|
||||
|
||||
* Remove deprecated `config` in `dbconsole`.
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
@ -149,9 +151,15 @@ Please refer to the [Changelog][active-record] for detailed changes.
|
|||
|
||||
* Remove deprecated `Tasks::DatabaseTasks.current_config`.
|
||||
|
||||
* Remove deprecated `ActiveRecord::Connection#allowed_index_name_length`.
|
||||
|
||||
* Remove deprecated `ActiveRecord::Connection#in_clause_length`.
|
||||
|
||||
* Remove deprecated `ActiveRecord::DatabaseConfigurations::DatabaseConfig#spec_name`.
|
||||
|
||||
### Deprecations
|
||||
|
||||
* Deprecated `Tasks::DatabaseTasks.:schema_file_type`.
|
||||
* Deprecated `Tasks::DatabaseTasks.schema_file_type`.
|
||||
|
||||
### Notable changes
|
||||
|
||||
|
@ -264,6 +272,8 @@ Please refer to the [Changelog][active-job] for detailed changes.
|
|||
|
||||
* Remove deprecated `ActiveRecord::Result#map!` and `ActiveRecord::Result#collect!`.
|
||||
|
||||
* Remove deprecated `ActiveRecord::Base#remove_connection`.
|
||||
|
||||
### Deprecations
|
||||
|
||||
* Deprecated `Rails.config.active_job.skip_after_callbacks_if_terminated`.
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
* Remove deprecated `config` in `dbconsole`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Change default `X-XSS-Protection` header to disable XSS auditor
|
||||
|
||||
This header has been deprecated and the XSS auditor it triggered
|
||||
|
|
|
@ -94,11 +94,6 @@ module Rails
|
|||
end
|
||||
end
|
||||
|
||||
def config
|
||||
db_config.configuration_hash
|
||||
end
|
||||
deprecate config: "please use db_config.configuration_hash"
|
||||
|
||||
def db_config
|
||||
return @db_config if defined?(@db_config)
|
||||
|
||||
|
|
Loading…
Reference in a new issue