Class: Hanami::CLI::Commands::App::DB::Rollback Private
- Inherits:
-
Command
- Object
- Dry::CLI::Command
- Hanami::CLI::Command
- Command
- Hanami::CLI::Commands::App::DB::Rollback
- Defined in:
- lib/hanami/cli/commands/app/db/rollback.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
Constants inherited from Command
Instance Method Summary collapse
Methods inherited from Command
#app, #database, #database_config, inherited, #measure, #run_command
Methods inherited from Hanami::CLI::Command
Constructor Details
This class inherits a constructor from Hanami::CLI::Command
Instance Method Details
#call(target: nil, dump: true) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hanami/cli/commands/app/db/rollback.rb', line 19 def call(target: nil, dump: true, **) migration_code, migration_name = find_migration(target) if migration_name.nil? output = if target "==> migration file for target #{target} was not found" else "==> no migrations to rollback" end out.puts output return end measure "database #{database.name} rolled back to #{migration_name}" do database.run_migrations(target: Integer(migration_code)) true end run_command Structure::Dump if dump end |