Class: Ponytail::MigrationsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/ponytail/migrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/ponytail/migrations_controller.rb', line 15

def create
  @migration = Migration.new(migraion_params)

  if @migration.save
    redirect_to :migrations, notice: 'Migration was successfully created.'
  else
    @schema = Schema.new
    render action: :new
  end
end

#indexObject



5
6
7
8
# File 'app/controllers/ponytail/migrations_controller.rb', line 5

def index
  @migrations = Migration.all
  @current_version = Migration.current_version
end

#migrateObject



26
27
28
29
30
31
32
# File 'app/controllers/ponytail/migrations_controller.rb', line 26

def migrate
  if Migration.migrate
    redirect_to :migrations, notice: 'Migrate was succeed.'
  else
    redirect_to :migrations, notice: 'Migrate was failed.'
  end
end

#newObject



10
11
12
13
# File 'app/controllers/ponytail/migrations_controller.rb', line 10

def new
  @migration = Migration.new
  @schema = Schema.new
end

#rollbackObject



34
35
36
37
38
39
40
# File 'app/controllers/ponytail/migrations_controller.rb', line 34

def rollback
  if Migration.rollback
    redirect_to :migrations, notice: 'Rollback was succeed.'
  else
    redirect_to :migrations, notice: 'Rollback was failed.'
  end
end