Permalink
Browse files

Merge pull request #29768 from janpieper/sort-enabled-extensions-in-dump

Sort enabled adapter extensions in schema dump
  • Loading branch information...
eileencodes committed Jul 22, 2017
2 parents c1972c2 + 8dca921 commit 36a301a90aaea213caa54cf3825d3fc9b345c04e
Showing with 15 additions and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/schema_dumper.rb
  2. +14 −0 activerecord/test/cases/schema_dumper_test.rb
@@ -87,7 +87,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
@@ -303,6 +303,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

0 comments on commit 36a301a

Please sign in to comment.