module DataMapper::Migrations::SingletonMethods
Public Instance Methods
auto_migrate!(repository_name = nil)
click to toggle source
drops and recreates the repository upwards to match model definitions
@param [Symbol] name repository to act on, :default is the default
@api public
# File lib/dm-migrations/auto_migration.rb, line 21 def auto_migrate!(repository_name = nil) repository_execute(:auto_migrate!, repository_name) end
auto_upgrade!(repository_name = nil)
click to toggle source
@api public
# File lib/dm-migrations/auto_migration.rb, line 26 def auto_upgrade!(repository_name = nil) repository_execute(:auto_upgrade!, repository_name) end
migrate!(repository_name = nil)
click to toggle source
destructively migrates the repository upwards to match model definitions
@param [Symbol] name repository to act on, :default is the default
@api public
# File lib/dm-migrations/auto_migration.rb, line 12 def migrate!(repository_name = nil) repository(repository_name).migrate! end
Private Instance Methods
auto_migrate_down!(repository_name)
click to toggle source
@api semipublic
# File lib/dm-migrations/auto_migration.rb, line 33 def auto_migrate_down!(repository_name) repository_execute(:auto_migrate_down!, repository_name) end
auto_migrate_up!(repository_name)
click to toggle source
@api semipublic
# File lib/dm-migrations/auto_migration.rb, line 38 def auto_migrate_up!(repository_name) repository_execute(:auto_migrate_up!, repository_name) end
repository_execute(method, repository_name)
click to toggle source
@api private
# File lib/dm-migrations/auto_migration.rb, line 43 def repository_execute(method, 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