Permalink
Browse files

adding connection parameter to check_pending for migrations

  • Loading branch information...
1 parent c5034d6 commit 2862cd8e11fd76f943c224c12e90bd04c05eadd4 @kayvannj kayvannj committed with tenderlove Feb 9, 2014
Showing with 5 additions and 5 deletions.
  1. +5 −5 activerecord/lib/active_record/migration.rb
@@ -385,8 +385,8 @@ class << self
attr_accessor :delegate # :nodoc:
attr_accessor :disable_ddl_transaction # :nodoc:
- def check_pending!
- raise ActiveRecord::PendingMigrationError if ActiveRecord::Migrator.needs_migration?
+ def check_pending!(connection = Base.connection)
+ raise ActiveRecord::PendingMigrationError if ActiveRecord::Migrator.needs_migration?(connection)
end
def load_schema_if_pending!
@@ -830,7 +830,7 @@ def get_all_versions
SchemaMigration.all.map { |x| x.version.to_i }.sort
end
- def current_version
+ def current_version(connection = Base.connection)
sm_table = schema_migrations_table_name
if Base.connection.table_exists?(sm_table)
get_all_versions.max || 0
@@ -839,8 +839,8 @@ def current_version
end
end
- def needs_migration?
- current_version < last_version
+ def needs_migration?(connection = Base.connection)
+ current_version(connection) < last_version
end
def last_version

1 comment on commit 2862cd8

Along with this change, shouldn't the constructor of the schema_dumper.rb be calling the new method as well? (Line 48 at the moment)

Suggested Change:
@version = Migrator::current_version(@connection) rescue nil

Cheers! @tenderlove @kayvannj

Please sign in to comment.