aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2019-06-20 14:00:42 +0200
committereileencodes <eileencodes@gmail.com>2019-06-20 14:00:42 +0200
commit4feeee2abeaf61eed2f9ee8463d3ac9661ec8cc6 (patch)
treee93866577795dbd9a06c4f185f1c44ef3cf4c1d3
parente14f3f3c1186fb452ff0ff2d63577a5174a77c1f (diff)
downloadrails-4feeee2abeaf61eed2f9ee8463d3ac9661ec8cc6.tar.gz
rails-4feeee2abeaf61eed2f9ee8463d3ac9661ec8cc6.tar.bz2
rails-4feeee2abeaf61eed2f9ee8463d3ac9661ec8cc6.zip
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.
-rw-r--r--activerecord/lib/active_record/migration.rb4
-rw-r--r--activerecord/lib/active_record/schema_migration.rb2
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb1
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