aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorIan White <ian.w.white@gmail.com>2008-04-17 13:43:47 -0500
committerJoshua Peek <josh@joshpeek.com>2008-04-17 13:43:47 -0500
commit82b4faf81218bbd8916ab559590db236c7f80e46 (patch)
treee5b65fae3a5d54c93f660f2b56980acb86d5ff68 /activerecord/lib/active_record
parent9e1d506a8cfedef2fdd605e4cbf4bf53651ad214 (diff)
downloadrails-82b4faf81218bbd8916ab559590db236c7f80e46.tar.gz
rails-82b4faf81218bbd8916ab559590db236c7f80e46.tar.bz2
rails-82b4faf81218bbd8916ab559590db236c7f80e46.zip
Fix migrations when migrating to a specified version number with a fresh database [#1 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/migration.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index 573c6a4f02..1d63bb2f84 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -364,8 +364,10 @@ module ActiveRecord
end
def current_version
- Base.connection.select_values(
- "SELECT version FROM #{schema_migrations_table_name}").map(&:to_i).max || 0
+ version = Base.connection.select_values(
+ "SELECT version FROM #{schema_migrations_table_name}"
+ ).map(&:to_i).max rescue nil
+ version || 0
end
def proper_table_name(name)