Skip to content

Commit

Permalink
Remove deprecated name argument from #tables
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Dec 29, 2016
1 parent e646bad commit d5be101
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 30 deletions.
4 changes: 4 additions & 0 deletions activerecord/CHANGELOG.md
@@ -1,3 +1,7 @@
* Remove deprecated `name` argument from `#tables`.

*Rafael Mendonça França*

* Remove deprecated support to passing a column to `#quote`. * Remove deprecated support to passing a column to `#quote`.


*Rafael Mendonça França* *Rafael Mendonça França*
Expand Down
Expand Up @@ -43,7 +43,7 @@ def data_source_exists?(name)
end end


# Returns an array of table names defined in the database. # Returns an array of table names defined in the database.
def tables(name = nil) def tables
raise NotImplementedError, "#tables is not implemented" raise NotImplementedError, "#tables is not implemented"
end end


Expand Down
Expand Up @@ -310,19 +310,13 @@ def collation
show_variable "collation_database" show_variable "collation_database"
end end


def tables(name = nil) # :nodoc: def tables # :nodoc:
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
#tables currently returns both tables and views. #tables currently returns both tables and views.
This behavior is deprecated and will be changed with Rails 5.1 to only return tables. This behavior is deprecated and will be changed with Rails 5.1 to only return tables.
Use #data_sources instead. Use #data_sources instead.
MSG MSG


if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing arguments to #tables is deprecated without replacement.
MSG
end

data_sources data_sources
end end


Expand Down
Expand Up @@ -71,13 +71,7 @@ def drop_database(name) #:nodoc:
end end


# Returns the list of all tables in the schema search path. # Returns the list of all tables in the schema search path.
def tables(name = nil) def tables
if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing arguments to #tables is deprecated without replacement.
MSG
end

select_values("SELECT tablename FROM pg_tables WHERE schemaname = ANY(current_schemas(false))", "SCHEMA") select_values("SELECT tablename FROM pg_tables WHERE schemaname = ANY(current_schemas(false))", "SCHEMA")
end end


Expand Down
Expand Up @@ -259,19 +259,13 @@ def exec_rollback_db_transaction #:nodoc:


# SCHEMA STATEMENTS ======================================== # SCHEMA STATEMENTS ========================================


def tables(name = nil) # :nodoc: def tables # :nodoc:
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
#tables currently returns both tables and views. #tables currently returns both tables and views.
This behavior is deprecated and will be changed with Rails 5.1 to only return tables. This behavior is deprecated and will be changed with Rails 5.1 to only return tables.
Use #data_sources instead. Use #data_sources instead.
MSG MSG


if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing arguments to #tables is deprecated without replacement.
MSG
end

data_sources data_sources
end end


Expand Down
4 changes: 0 additions & 4 deletions activerecord/test/cases/adapter_test.rb
Expand Up @@ -300,10 +300,6 @@ def test_tables_returning_both_tables_and_views_is_deprecated
assert_deprecated { @connection.tables } assert_deprecated { @connection.tables }
end end
end end

def test_passing_arguments_to_tables_is_deprecated
assert_deprecated { @connection.tables(:books) }
end
end end


class AdapterTestWithoutTransaction < ActiveRecord::TestCase class AdapterTestWithoutTransaction < ActiveRecord::TestCase
Expand Down
Expand Up @@ -90,7 +90,7 @@ def test_reset_with_transaction
end end


def test_tables_logs_name def test_tables_logs_name
ActiveSupport::Deprecation.silence { @connection.tables("hello") } @connection.tables
assert_equal "SCHEMA", @subscriber.logged[0][1] assert_equal "SCHEMA", @subscriber.logged[0][1]
end end


Expand Down
Expand Up @@ -280,9 +280,7 @@ def test_tables_logs_name
WHERE type IN ('table','view') AND name <> 'sqlite_sequence' WHERE type IN ('table','view') AND name <> 'sqlite_sequence'
SQL SQL
assert_logged [[sql.squish, "SCHEMA", []]] do assert_logged [[sql.squish, "SCHEMA", []]] do
ActiveSupport::Deprecation.silence do @conn.tables
@conn.tables("hello")
end
end end
end end


Expand Down

0 comments on commit d5be101

Please sign in to comment.