提交 91abb1c2 编写于 作者: R Rafael França 提交者: Rafael Mendonça França

Merge pull request #29462 from kamipo/fix_dump_schema_information_with_empty_versions

Fix `dump_schema_information` with empty versions
上级 8e59970d
......@@ -986,7 +986,7 @@ def foreign_key_options(from_table, to_table, options) # :nodoc:
def dump_schema_information #:nodoc:
versions = ActiveRecord::SchemaMigration.order('version').pluck(:version)
insert_versions_sql(versions)
insert_versions_sql(versions) if versions.any?
end
def insert_versions_sql(versions) # :nodoc:
......
......@@ -17,6 +17,12 @@ def perform_schema_dump
dump_all_table_schema []
end
def test_dump_schema_information_with_empty_versions
ActiveRecord::SchemaMigration.delete_all
schema_info = ActiveRecord::Base.connection.dump_schema_information
assert_no_match(/INSERT INTO/, schema_info)
end
def test_dump_schema_information_outputs_lexically_ordered_versions
versions = %w{ 20100101010101 20100201010101 20100301010101 }
versions.reverse_each do |v|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册