Class: Redmine::Plugin::MigrationContext

Inherits:
ActiveRecord::MigrationContext
  • Object
show all
Defined in:
lib/redmine/plugin.rb

Instance Method Summary collapse

Instance Method Details

#down(target_version = nil) ⇒ Object


513
514
515
516
517
518
519
520
521
# File 'lib/redmine/plugin.rb', line 513

def down(target_version = nil)
  selected_migrations =
    if block_given?
      migrations.select { |m| yield m }
    else
      migrations
    end
  Migrator.new(:down, selected_migrations, target_version).migrate
end

#openObject


527
528
529
# File 'lib/redmine/plugin.rb', line 527

def open
  Migrator.new(:up, migrations, nil)
end

#run(direction, target_version) ⇒ Object


523
524
525
# File 'lib/redmine/plugin.rb', line 523

def run(direction, target_version)
  Migrator.new(direction, migrations, target_version).run
end

#up(target_version = nil) ⇒ Object


503
504
505
506
507
508
509
510
511
# File 'lib/redmine/plugin.rb', line 503

def up(target_version = nil)
  selected_migrations =
    if block_given?
      migrations.select { |m| yield m }
    else
      migrations
    end
  Migrator.new(:up, selected_migrations, target_version).migrate
end