Class: Redmine::Plugin::MigrationContext

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

Instance Method Summary collapse

Instance Method Details

#current_versionObject



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

def current_version
  Migrator.current_version
end

#down(target_version = nil) ⇒ Object



496
497
498
499
500
501
502
503
504
# File 'lib/redmine/plugin.rb', line 496

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

#openObject



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

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

#run(direction, target_version) ⇒ Object



506
507
508
# File 'lib/redmine/plugin.rb', line 506

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

#up(target_version = nil) ⇒ Object



486
487
488
489
490
491
492
493
494
# File 'lib/redmine/plugin.rb', line 486

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