From 4feeee2abeaf61eed2f9ee8463d3ac9661ec8cc6 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Thu, 20 Jun 2019 14:00:42 +0200 Subject: 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. --- activerecord/lib/active_record/migration.rb | 4 ++-- activerecord/lib/active_record/schema_migration.rb | 2 +- activerecord/test/cases/schema_dumper_test.rb | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 9db017cded..7edfec9903 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -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 diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb index 58b21d2cc8..dec7fee986 100644 --- a/activerecord/lib/active_record/schema_migration.rb +++ b/activerecord/lib/active_record/schema_migration.rb @@ -45,7 +45,7 @@ module ActiveRecord end def all_versions - order(:version).pluck(:version).map(&:to_i) + order(:version).pluck(:version) end end diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 49e9be9565..bb7184c5fc 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -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 -- cgit v1.2.3