Class: Pgchief::Command::DatabaseRestore
- Extended by:
- Forwardable
- Defined in:
- lib/pgchief/command/database_restore.rb
Overview
Command object to restore a database
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Pgchief::Command::Base
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
11 12 13 |
# File 'lib/pgchief/command/database_restore.rb', line 11 def database @database end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
11 12 13 |
# File 'lib/pgchief/command/database_restore.rb', line 11 def filename @filename end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pgchief/command/database_restore.rb', line 15 def call @database = params.first @filename = params.last raise Pgchief::Errors::DatabaseMissingError unless db_exists? download! if Pgchief::Config.remote_restore restore! "Database '#{database}' restored from #{filename}" rescue PG::Error => e "Error: #{e.}" ensure conn.close end |