Permalink
Browse files

Remove deprecated argument `name` from `#indexes`

  • Loading branch information...
rafaelfranca committed Sep 15, 2017
1 parent 7df6e3f commit d6b779ecebe57f6629352c34bfd6c442ac8fba0e
@@ -1,3 +1,7 @@
* Remove deprecated argument `name` from `#indexes`.
*Rafael Mendonça França*
* Remove deprecated method `ActiveRecord::Migrator.schema_migrations_table_name`.
*Rafael Mendonça França*
@@ -79,7 +79,7 @@ def view_exists?(view_name)
end
# Returns an array of indexes for the given table.
def indexes(table_name, name = nil)
def indexes(table_name)
raise NotImplementedError, "#indexes is not implemented"
end
@@ -5,13 +5,7 @@ module ConnectionAdapters
module MySQL
module SchemaStatements # :nodoc:
# Returns an array of indexes for the given table.
def indexes(table_name, name = nil)
if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing name to #indexes is deprecated without replacement.
MSG
end
def indexes(table_name)
indexes = []
current_index = nil
execute_and_free("SHOW KEYS FROM #{quote_table_name(table_name)}", "SCHEMA") do |result|
@@ -1,7 +1,5 @@
# frozen_string_literal: true
require "active_support/core_ext/string/strip"
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
@@ -84,13 +82,7 @@ def index_name_exists?(table_name, index_name)
end
# Returns an array of indexes for the given table.
def indexes(table_name, name = nil) # :nodoc:
if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing name to #indexes is deprecated without replacement.
MSG
end
def indexes(table_name) # :nodoc:
scope = quoted_scope(table_name)
result = query(<<-SQL, "SCHEMA")
@@ -5,13 +5,7 @@ module ConnectionAdapters
module SQLite3
module SchemaStatements # :nodoc:
# Returns an array of indexes for the given table.
def indexes(table_name, name = nil)
if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing name to #indexes is deprecated without replacement.
MSG
end
def indexes(table_name)
exec_query("PRAGMA index_list(#{quote_table_name(table_name)})", "SCHEMA").map do |row|
index_sql = query_value(<<-SQL, "SCHEMA")
SELECT sql
@@ -103,7 +103,7 @@ def test_tables_logs_name
end
def test_indexes_logs_name
assert_deprecated { @connection.indexes("items", "hello") }
@connection.indexes("items")
assert_equal "SCHEMA", @subscriber.logged[0][1]
end
@@ -269,14 +269,6 @@ def test_tables_logs_name
end
end
def test_indexes_logs_name
with_example_table do
assert_logged [["PRAGMA index_list(\"ex\")", "SCHEMA", []]] do
assert_deprecated { @conn.indexes("ex", "hello") }
end
end
end
def test_table_exists_logs_name
with_example_table do
sql = <<-SQL

0 comments on commit d6b779e

Please sign in to comment.