Class: Redmine::Plugin::MigrationContext

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

Overview

Since:

  • 4.0.0

Instance Method Summary collapse

Instance Method Details

#down(target_version = nil) ⇒ Object



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

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



515
516
517
# File 'lib/redmine/plugin.rb', line 515

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

#run(direction, target_version) ⇒ Object



511
512
513
# File 'lib/redmine/plugin.rb', line 511

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

#up(target_version = nil) ⇒ Object



491
492
493
494
495
496
497
498
499
# File 'lib/redmine/plugin.rb', line 491

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