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



471
472
473
474
475
476
477
478
479
# File 'lib/redmine/plugin.rb', line 471

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



485
486
487
# File 'lib/redmine/plugin.rb', line 485

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

#run(direction, target_version) ⇒ Object



481
482
483
# File 'lib/redmine/plugin.rb', line 481

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

#up(target_version = nil) ⇒ Object



461
462
463
464
465
466
467
468
469
# File 'lib/redmine/plugin.rb', line 461

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