Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate most methods which were never used in DatabaseLimits #33799

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions activerecord/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 used to return a hash, but this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "active_support/deprecation"

module ActiveRecord
module ConnectionAdapters # :nodoc:
module DatabaseLimits
Expand All @@ -12,11 +14,13 @@ def table_alias_length
def column_name_length
64
end
deprecate :column_name_length

# Returns the maximum length of a table name.
def table_name_length
64
end
deprecate :table_name_length

# Returns the maximum allowed length for an index name. This
# limit is enforced by \Rails and is less than or equal to
Expand All @@ -36,16 +40,19 @@ def index_name_length
def columns_per_table
1024
end
deprecate :columns_per_table

# Returns the maximum number of indexes per table.
def indexes_per_table
16
end
deprecate :indexes_per_table

# Returns the maximum number of columns in a multicolumn index.
def columns_per_multicolumn_index
16
end
deprecate :columns_per_multicolumn_index

# Returns the maximum number of elements in an IN (x,y,z) clause.
# +nil+ means no limit.
Expand All @@ -57,11 +64,13 @@ def in_clause_length
def sql_query_length
1048575
end
deprecate :sql_query_length

# Returns maximum number of joins in a single query.
def joins_per_query
256
end
deprecate :joins_per_query
end
end
end
28 changes: 28 additions & 0 deletions activerecord/test/cases/adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,34 @@ def test_log_invalid_encoding
def test_supports_multi_insert_is_deprecated
assert_deprecated { @connection.supports_multi_insert? }
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

class AdapterForeignKeyTest < ActiveRecord::TestCase
Expand Down