Browse files

Respect repository scope when specified.

Previously, given configured repositories :a and :b, auto_{upgrade,migrate}!(:a)
would affect :b also.
  • Loading branch information...
1 parent 09c652e commit 3409e9f9c3dc121b68a4b8241b8b55de102e816b @jpr5 jpr5 committed Jul 1, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/dm-migrations/auto_migration.rb
View
6 lib/dm-migrations/auto_migration.rb
@@ -41,8 +41,10 @@ def auto_migrate_up!(repository_name)
# @api private
def repository_execute(method, repository_name)
- DataMapper::Model.descendants.each do |model|
- model.send(method, repository_name || model.default_repository_name)
+ models = DataMapper::Model.descendants
+ models = models.select { |m| m.default_repository_name == repository_name } if repository_name
+ models.each do |model|
+ model.send(method, model.default_repository_name)
end
end
end

0 comments on commit 3409e9f

Please sign in to comment.