Class: GeoserverMigrations::Generators::RedoGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/geoserver_migrations/redo/redo_generator.rb

Instance Method Summary collapse

Instance Method Details

#rollback_migrationsObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/geoserver_migrations/redo/redo_generator.rb', line 6

def rollback_migrations
  migrator = GeoserverMigrations::Migrator.new
  migrator.migrations_paths = GeoserverMigrations.migrations_rootpath
  # there should not be any pending migrations!
  if migrator.needs_migration?
    puts "There are pending migrations! We can only redo the last migration if there are no pending migrations."
  else
    migrator.rollback
    migrator.migrate
  end
end