class Naifa::Plugins::Postgres::CLI

Attributes

settings_key[R]

Public Instance Methods

backup(from=nil) click to toggle source
# File lib/naifa/plugins/postgres/cli.rb, line 24
def backup(from=nil)
  config = Naifa::Config.settings[settings_key] || {}
  options = from.nil? ? {} : {backup: {environment: from}}

  Postgres.backup(config.fetch(:settings,{}).deep_merge(options))
end
restore(to=nil) click to toggle source
# File lib/naifa/plugins/postgres/cli.rb, line 32
def restore(to=nil)
  config = Naifa::Config.settings[settings_key] || {}
  options = to.nil? ? {} : {restore: {environment: to}}

  Postgres.restore(config.fetch(:settings,{}).deep_merge(options))
end
settings_key() click to toggle source
# File lib/naifa/plugins/postgres/cli.rb, line 40
def settings_key
  self.class.settings_key
end
sync(from=nil, to=nil) click to toggle source
# File lib/naifa/plugins/postgres/cli.rb, line 13
def sync(from=nil, to=nil)
  config = Naifa::Config.settings[settings_key] || {}

  options = {backup: {}, restore: {}}
  options[:backup][:environment] = from unless from.nil?
  options[:restore][:environment] = to unless to.nil?

  Postgres.sync(config.fetch(:settings,{}).deep_merge(options))
end