mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #17697 from sgrif/sg-remove-is-a-check-when-ignoring-tables
Remove is_a? check when ignoring tables
This commit is contained in:
commit
e6089029c4
2 changed files with 1 additions and 16 deletions
|
@ -244,12 +244,7 @@ HEADER
|
||||||
|
|
||||||
def ignored?(table_name)
|
def ignored?(table_name)
|
||||||
['schema_migrations', ignore_tables].flatten.any? do |ignored|
|
['schema_migrations', ignore_tables].flatten.any? do |ignored|
|
||||||
case ignored
|
ignored === remove_prefix_and_suffix(table_name)
|
||||||
when String; remove_prefix_and_suffix(table_name) == ignored
|
|
||||||
when Regexp; remove_prefix_and_suffix(table_name) =~ ignored
|
|
||||||
else
|
|
||||||
raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -162,16 +162,6 @@ class SchemaDumperTest < ActiveRecord::TestCase
|
||||||
assert_no_match %r{create_table "schema_migrations"}, output
|
assert_no_match %r{create_table "schema_migrations"}, output
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_schema_dump_illegal_ignored_table_value
|
|
||||||
stream = StringIO.new
|
|
||||||
old_ignore_tables, ActiveRecord::SchemaDumper.ignore_tables = ActiveRecord::SchemaDumper.ignore_tables, [5]
|
|
||||||
assert_raise(StandardError) do
|
|
||||||
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
|
|
||||||
end
|
|
||||||
ensure
|
|
||||||
ActiveRecord::SchemaDumper.ignore_tables = old_ignore_tables
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_schema_dumps_index_columns_in_right_order
|
def test_schema_dumps_index_columns_in_right_order
|
||||||
index_definition = standard_dump.split(/\n/).grep(/add_index.*companies/).first.strip
|
index_definition = standard_dump.split(/\n/).grep(/add_index.*companies/).first.strip
|
||||||
if current_adapter?(:MysqlAdapter, :Mysql2Adapter, :PostgreSQLAdapter)
|
if current_adapter?(:MysqlAdapter, :Mysql2Adapter, :PostgreSQLAdapter)
|
||||||
|
|
Loading…
Reference in a new issue