Class: SlashMigrate::MigrationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/slash_migrate/migrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



16
17
18
19
20
# File 'app/controllers/slash_migrate/migrations_controller.rb', line 16

def destroy
  result = runner.delete(params[:version])
  flash[result.success? ? :notice : :alert] = result.output
  redirect_to migrations_path
end

#indexObject



3
4
5
6
# File 'app/controllers/slash_migrate/migrations_controller.rb', line 3

def index
  @migrations = runner.status
  @pending = runner.pending?
end

#rollbackObject



12
13
14
# File 'app/controllers/slash_migrate/migrations_controller.rb', line 12

def rollback
  finish(runner.rollback, "Rolled back the last migration.", "rails db:rollback")
end

#runObject



8
9
10
# File 'app/controllers/slash_migrate/migrations_controller.rb', line 8

def run
  finish(runner.migrate, "Migrated.", "rails db:migrate")
end