提交 8dca9219 编写于 作者: J Jan Pieper

Sort enabled adapter extensions in schema dump

The list of enabled adapter extensions in the schema dump isn't
sorted by default, so it may happen that the sorting changes
over time. If you're using a VCS, a change to the sorting results
in a diff without any real change. Sorting the list should solve
this problem.
上级 58f10a31
......@@ -85,7 +85,7 @@ def extensions(stream)
extensions = @connection.extensions
if extensions.any?
stream.puts " # These are extensions that must be enabled in order to support this database"
extensions.each do |extension|
extensions.sort.each do |extension|
stream.puts " enable_extension #{extension.inspect}"
end
stream.puts
......
......@@ -301,6 +301,20 @@ def test_schema_dump_includes_extensions
assert_no_match "# These are extensions that must be enabled", output
assert_no_match %r{enable_extension}, output
end
def test_schema_dump_includes_extensions_in_alphabetic_order
connection = ActiveRecord::Base.connection
connection.stubs(:extensions).returns(["hstore", "uuid-ossp", "xml2"])
output = perform_schema_dump
enabled_extensions = output.scan(%r{enable_extension "(.+)"}).flatten
assert_equal ["hstore", "uuid-ossp", "xml2"], enabled_extensions
connection.stubs(:extensions).returns(["uuid-ossp", "xml2", "hstore"])
output = perform_schema_dump
enabled_extensions = output.scan(%r{enable_extension "(.+)"}).flatten
assert_equal ["hstore", "uuid-ossp", "xml2"], enabled_extensions
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册