Class: Pgchief::Prompt::RestoreDatabase
- Defined in:
- lib/pgchief/prompt/restore_database.rb
Overview
Class to prompt for which database to restore
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
call, #initialize, #klassify, #prompt, #yes_or_no
Constructor Details
This class inherits a constructor from Pgchief::Prompt::Base
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pgchief/prompt/restore_database.rb', line 7 def call database = prompt.select('Which database needs restoring?', Pgchief::Database.all) backups = Pgchief::Database.backups_for(database, remote: Pgchief::Config.remote_restore) if backups.empty? prompt.warn "No backup files found for database '#{database}'" else local_file = prompt.select('Which backup file do you want to restore?', backups) result = Pgchief::Command::DatabaseRestore.call(database, local_file) prompt.say result end end |