Merge pull request #33799 from kamipo/deprecate_unused_methods_in_database_limits
Deprecate most methods which were never used in `DatabaseLimits`
This commit is contained in:
commit
54a9dbf5f1
@ -1,3 +1,9 @@
|
|||||||
|
* Deprecate `column_name_length`, `table_name_length`, `columns_per_table`,
|
||||||
|
`indexes_per_table`, `columns_per_multicolumn_index`, `sql_query_length`,
|
||||||
|
and `joins_per_query` methods in `DatabaseLimits`.
|
||||||
|
|
||||||
|
*Ryuta Kamizono*
|
||||||
|
|
||||||
* ActiveRecord::Base.configurations now returns an object.
|
* ActiveRecord::Base.configurations now returns an object.
|
||||||
|
|
||||||
ActiveRecord::Base.configurations used to return a hash, but this
|
ActiveRecord::Base.configurations used to return a hash, but this
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "active_support/deprecation"
|
||||||
|
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module ConnectionAdapters # :nodoc:
|
module ConnectionAdapters # :nodoc:
|
||||||
module DatabaseLimits
|
module DatabaseLimits
|
||||||
@ -12,11 +14,13 @@ def table_alias_length
|
|||||||
def column_name_length
|
def column_name_length
|
||||||
64
|
64
|
||||||
end
|
end
|
||||||
|
deprecate :column_name_length
|
||||||
|
|
||||||
# Returns the maximum length of a table name.
|
# Returns the maximum length of a table name.
|
||||||
def table_name_length
|
def table_name_length
|
||||||
64
|
64
|
||||||
end
|
end
|
||||||
|
deprecate :table_name_length
|
||||||
|
|
||||||
# Returns the maximum allowed length for an index name. This
|
# Returns the maximum allowed length for an index name. This
|
||||||
# limit is enforced by \Rails and is less than or equal to
|
# limit is enforced by \Rails and is less than or equal to
|
||||||
@ -36,16 +40,19 @@ def index_name_length
|
|||||||
def columns_per_table
|
def columns_per_table
|
||||||
1024
|
1024
|
||||||
end
|
end
|
||||||
|
deprecate :columns_per_table
|
||||||
|
|
||||||
# Returns the maximum number of indexes per table.
|
# Returns the maximum number of indexes per table.
|
||||||
def indexes_per_table
|
def indexes_per_table
|
||||||
16
|
16
|
||||||
end
|
end
|
||||||
|
deprecate :indexes_per_table
|
||||||
|
|
||||||
# Returns the maximum number of columns in a multicolumn index.
|
# Returns the maximum number of columns in a multicolumn index.
|
||||||
def columns_per_multicolumn_index
|
def columns_per_multicolumn_index
|
||||||
16
|
16
|
||||||
end
|
end
|
||||||
|
deprecate :columns_per_multicolumn_index
|
||||||
|
|
||||||
# Returns the maximum number of elements in an IN (x,y,z) clause.
|
# Returns the maximum number of elements in an IN (x,y,z) clause.
|
||||||
# +nil+ means no limit.
|
# +nil+ means no limit.
|
||||||
@ -57,11 +64,13 @@ def in_clause_length
|
|||||||
def sql_query_length
|
def sql_query_length
|
||||||
1048575
|
1048575
|
||||||
end
|
end
|
||||||
|
deprecate :sql_query_length
|
||||||
|
|
||||||
# Returns maximum number of joins in a single query.
|
# Returns maximum number of joins in a single query.
|
||||||
def joins_per_query
|
def joins_per_query
|
||||||
256
|
256
|
||||||
end
|
end
|
||||||
|
deprecate :joins_per_query
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -300,6 +300,34 @@ def test_log_invalid_encoding
|
|||||||
def test_supports_multi_insert_is_deprecated
|
def test_supports_multi_insert_is_deprecated
|
||||||
assert_deprecated { @connection.supports_multi_insert? }
|
assert_deprecated { @connection.supports_multi_insert? }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_column_name_length_is_deprecated
|
||||||
|
assert_deprecated { @connection.column_name_length }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_table_name_length_is_deprecated
|
||||||
|
assert_deprecated { @connection.table_name_length }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_columns_per_table_is_deprecated
|
||||||
|
assert_deprecated { @connection.columns_per_table }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_indexes_per_table_is_deprecated
|
||||||
|
assert_deprecated { @connection.indexes_per_table }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_columns_per_multicolumn_index_is_deprecated
|
||||||
|
assert_deprecated { @connection.columns_per_multicolumn_index }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_sql_query_length_is_deprecated
|
||||||
|
assert_deprecated { @connection.sql_query_length }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_joins_per_query_is_deprecated
|
||||||
|
assert_deprecated { @connection.joins_per_query }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class AdapterForeignKeyTest < ActiveRecord::TestCase
|
class AdapterForeignKeyTest < ActiveRecord::TestCase
|
||||||
|
Loading…
Reference in New Issue
Block a user