Class: Deploio::Commands::PostgreSQLBackups
- Inherits:
-
Thor
- Object
- Thor
- Deploio::Commands::PostgreSQLBackups
- Includes:
- SharedOptions
- Defined in:
- lib/deploio/commands/postgresql_backups.rb
Constant Summary collapse
- DEDICATED_KIND =
"Postgres"- ECONOMY_KIND =
"PostgresDatabase"
Instance Method Summary collapse
Methods included from SharedOptions
Instance Method Details
#capture(name) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/deploio/commands/postgresql_backups.rb', line 14 def capture(name) backup_service_for(name).capture rescue Deploio::Error => e Output.error(e.) exit 1 end |
#download(name) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/deploio/commands/postgresql_backups.rb', line 41 def download(name) service = backup_service_for(name) destination = [:output] || service.default_destination backup = service.download(destination: destination, db_name: [:db_name]) # Only the economy tier knows when its backup was taken. if backup Output.success("Downloaded backup from #{format_time(backup["ModTime"])} to #{destination}") else Output.success("Downloaded backup to #{destination}") end rescue Deploio::Error => e Output.error(e.) exit 1 end |
#list(name) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/deploio/commands/postgresql_backups.rb', line 22 def list(name) backups = backup_service_for(name).backups if backups.empty? Output.warning("No backups found for '#{name}'") return end rows = backups.map do |backup| [format_time(backup["ModTime"]), format_size(backup["Size"]), backup["Name"]] end Output.table(rows, headers: ["DATE", "SIZE", "NAME"]) rescue Deploio::Error => e Output.error(e.) exit 1 end |