aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-05-06 14:16:03 -0300
committerEmilio Tagua <miloops@gmail.com>2009-05-06 14:16:03 -0300
commit8885b2d6c1855742600d0afdb9dfc002acb62e5e (patch)
tree7c217e880d84e3bda88902a89540355d41be39c7 /activerecord/lib/active_record/migration.rb
parent118b19a9fa59587e72af315bfbc0e6812025f12b (diff)
downloadrails-8885b2d6c1855742600d0afdb9dfc002acb62e5e.tar.gz
rails-8885b2d6c1855742600d0afdb9dfc002acb62e5e.tar.bz2
rails-8885b2d6c1855742600d0afdb9dfc002acb62e5e.zip
Refactor to calculations. Migration's versions are string not integer. ARel submodule updated.
Diffstat (limited to 'activerecord/lib/active_record/migration.rb')
-rw-r--r--activerecord/lib/active_record/migration.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index aa9e9e8fdd..ce02fe019f 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -410,7 +410,7 @@ module ActiveRecord
def get_all_versions
table = Arel(schema_migrations_table_name)
- table.project(table['version']).select_values.map(&:to_i).sort
+ Base.connection.select_values(table.project(table['version']).to_sql).map(&:to_i).sort
end
def current_version
@@ -535,11 +535,11 @@ module ActiveRecord
@migrated_versions ||= []
if down?
- @migrated_versions.delete(version.to_i)
- table.where(table["version"].eq(version)).delete
+ @migrated_versions.delete(version)
+ table.where(table["version"].eq(version.to_s)).delete
else
- @migrated_versions.push(version.to_i).sort!
- table.insert table["version"] => version
+ @migrated_versions.push(version).sort!
+ table.insert table["version"] => version.to_s
end
end