Class: Pgchief::Command::QuickRestore

Inherits:
Base
  • Object
show all
Defined in:
lib/pgchief/command/quick_restore.rb

Overview

Command object to quickly restore the latest backup for a database

Instance Attribute Summary

Attributes inherited from Base

#conn, #params

Instance Method Summary collapse

Methods inherited from Base

call, #initialize

Constructor Details

This class inherits a constructor from Pgchief::Command::Base

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pgchief/command/quick_restore.rb', line 7

def call
  database = params.last
  Pgchief::Config.load_config!(params.first)
  Pgchief::Config.set_up_file_structure!

  filename = Pgchief::Database
             .backups_for(database, remote: Pgchief::Config.remote_restore)
             .first

  Pgchief::Command::DatabaseRestore.call(database, filename)
end