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


545
546
547
548
549
550
551
552
553
# File 'lib/redmine/plugin.rb', line 545

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


559
560
561
# File 'lib/redmine/plugin.rb', line 559

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

#run(direction, target_version) ⇒ Object


555
556
557
# File 'lib/redmine/plugin.rb', line 555

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

#up(target_version = nil) ⇒ Object


535
536
537
538
539
540
541
542
543
# File 'lib/redmine/plugin.rb', line 535

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