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