Skip to content

Commit d6b779e

Browse files
committed
Remove deprecated argument name from #indexes
1 parent 7df6e3f commit d6b779e

File tree

7 files changed

+9
-33
lines changed

7 files changed

+9
-33
lines changed

activerecord/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated argument `name` from `#indexes`.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated method `ActiveRecord::Migrator.schema_migrations_table_name`.
26

37
*Rafael Mendonça França*

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def view_exists?(view_name)
7979
end
8080

8181
# Returns an array of indexes for the given table.
82-
def indexes(table_name, name = nil)
82+
def indexes(table_name)
8383
raise NotImplementedError, "#indexes is not implemented"
8484
end
8585

activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ module ConnectionAdapters
55
module MySQL
66
module SchemaStatements # :nodoc:
77
# Returns an array of indexes for the given table.
8-
def indexes(table_name, name = nil)
9-
if name
10-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
11-
Passing name to #indexes is deprecated without replacement.
12-
MSG
13-
end
14-
8+
def indexes(table_name)
159
indexes = []
1610
current_index = nil
1711
execute_and_free("SHOW KEYS FROM #{quote_table_name(table_name)}", "SCHEMA") do |result|

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require "active_support/core_ext/string/strip"
4-
53
module ActiveRecord
64
module ConnectionAdapters
75
module PostgreSQL
@@ -84,13 +82,7 @@ def index_name_exists?(table_name, index_name)
8482
end
8583

8684
# Returns an array of indexes for the given table.
87-
def indexes(table_name, name = nil) # :nodoc:
88-
if name
89-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
90-
Passing name to #indexes is deprecated without replacement.
91-
MSG
92-
end
93-
85+
def indexes(table_name) # :nodoc:
9486
scope = quoted_scope(table_name)
9587

9688
result = query(<<-SQL, "SCHEMA")

activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ module ConnectionAdapters
55
module SQLite3
66
module SchemaStatements # :nodoc:
77
# Returns an array of indexes for the given table.
8-
def indexes(table_name, name = nil)
9-
if name
10-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
11-
Passing name to #indexes is deprecated without replacement.
12-
MSG
13-
end
14-
8+
def indexes(table_name)
159
exec_query("PRAGMA index_list(#{quote_table_name(table_name)})", "SCHEMA").map do |row|
1610
index_sql = query_value(<<-SQL, "SCHEMA")
1711
SELECT sql

activerecord/test/cases/adapters/postgresql/connection_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_tables_logs_name
103103
end
104104

105105
def test_indexes_logs_name
106-
assert_deprecated { @connection.indexes("items", "hello") }
106+
@connection.indexes("items")
107107
assert_equal "SCHEMA", @subscriber.logged[0][1]
108108
end
109109

activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb

-8
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,6 @@ def test_tables_logs_name
269269
end
270270
end
271271

272-
def test_indexes_logs_name
273-
with_example_table do
274-
assert_logged [["PRAGMA index_list(\"ex\")", "SCHEMA", []]] do
275-
assert_deprecated { @conn.indexes("ex", "hello") }
276-
end
277-
end
278-
end
279-
280272
def test_table_exists_logs_name
281273
with_example_table do
282274
sql = <<-SQL

0 commit comments

Comments
 (0)