Permalink
Browse files

Remove deprecated `name` argument from `#tables`

  • Loading branch information...
rafaelfranca committed Dec 29, 2016
1 parent e646bad commit d5be101dd02214468a27b6839ffe338cfe8ef5f3
@@ -1,3 +1,7 @@
* Remove deprecated `name` argument from `#tables`.
*Rafael Mendonça França*
* Remove deprecated support to passing a column to `#quote`.
*Rafael Mendonça França*
@@ -43,7 +43,7 @@ def data_source_exists?(name)
end
# Returns an array of table names defined in the database.
def tables(name = nil)
def tables
raise NotImplementedError, "#tables is not implemented"
end
@@ -310,19 +310,13 @@ def collation
show_variable "collation_database"
end
def tables(name = nil) # :nodoc:
def tables # :nodoc:
ActiveSupport::Deprecation.warn(<<-MSG.squish)
#tables currently returns both tables and views.
This behavior is deprecated and will be changed with Rails 5.1 to only return tables.
Use #data_sources instead.
MSG
if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing arguments to #tables is deprecated without replacement.
MSG
end
data_sources
end
@@ -71,13 +71,7 @@ def drop_database(name) #:nodoc:
end
# Returns the list of all tables in the schema search path.
def tables(name = nil)
if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing arguments to #tables is deprecated without replacement.
MSG
end
def tables
select_values("SELECT tablename FROM pg_tables WHERE schemaname = ANY(current_schemas(false))", "SCHEMA")
end
@@ -259,19 +259,13 @@ def exec_rollback_db_transaction #:nodoc:
# SCHEMA STATEMENTS ========================================
def tables(name = nil) # :nodoc:
def tables # :nodoc:
ActiveSupport::Deprecation.warn(<<-MSG.squish)
#tables currently returns both tables and views.
This behavior is deprecated and will be changed with Rails 5.1 to only return tables.
Use #data_sources instead.
MSG
if name
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing arguments to #tables is deprecated without replacement.
MSG
end
data_sources
end
@@ -300,10 +300,6 @@ def test_tables_returning_both_tables_and_views_is_deprecated
assert_deprecated { @connection.tables }
end
end
def test_passing_arguments_to_tables_is_deprecated
assert_deprecated { @connection.tables(:books) }
end
end
class AdapterTestWithoutTransaction < ActiveRecord::TestCase
@@ -90,7 +90,7 @@ def test_reset_with_transaction
end
def test_tables_logs_name
ActiveSupport::Deprecation.silence { @connection.tables("hello") }
@connection.tables
assert_equal "SCHEMA", @subscriber.logged[0][1]
end
@@ -280,9 +280,7 @@ def test_tables_logs_name
WHERE type IN ('table','view') AND name <> 'sqlite_sequence'
SQL
assert_logged [[sql.squish, "SCHEMA", []]] do
ActiveSupport::Deprecation.silence do
@conn.tables("hello")
end
@conn.tables
end
end

0 comments on commit d5be101

Please sign in to comment.