1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert schema dumper to use strings rather than integers

I think we should change this, but not in 6-0-stable since that's
already in RC and I was trying to only make changes that won't require
any app changes.

This reverts a portion of https://github.com/rails/rails/pull/36439 that
made all schema migration version numbers get dumped as an integer.
While it doesn't _really_ matter it did change behavior. We should bring
this back in 6.1 with a deprecation.
This commit is contained in:
eileencodes 2019-06-20 14:00:42 +02:00
parent e14f3f3c11
commit 4feeee2abe
3 changed files with 4 additions and 3 deletions

View file

@ -1071,7 +1071,7 @@ module ActiveRecord
def get_all_versions
if schema_migration.table_exists?
schema_migration.all_versions
schema_migration.all_versions.map(&:to_i)
else
[]
end
@ -1247,7 +1247,7 @@ module ActiveRecord
end
def load_migrated
@migrated_versions = Set.new(@schema_migration.all_versions)
@migrated_versions = Set.new(@schema_migration.all_versions.map(&:to_i))
end
private

View file

@ -45,7 +45,7 @@ module ActiveRecord
end
def all_versions
order(:version).pluck(:version).map(&:to_i)
order(:version).pluck(:version)
end
end

View file

@ -33,6 +33,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
schema_info = ActiveRecord::Base.connection.dump_schema_information
assert_match(/20100201010101.*20100301010101/m, schema_info)
assert_includes schema_info, "20100101010101"
ensure
ActiveRecord::SchemaMigration.delete_all
end