diff options
author | Ian White <ian.w.white@gmail.com> | 2008-04-17 13:43:47 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-04-17 13:43:47 -0500 |
commit | 82b4faf81218bbd8916ab559590db236c7f80e46 (patch) | |
tree | e5b65fae3a5d54c93f660f2b56980acb86d5ff68 /activerecord/lib | |
parent | 9e1d506a8cfedef2fdd605e4cbf4bf53651ad214 (diff) | |
download | rails-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')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 6 |
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) |