Sha256: 214488307638e49c18375740a52bdebda35e6a75c78e5dd9db09469d9564dc49

Contents?: true

Size: 806 Bytes

Versions: 1

Compression:

Stored size: 806 Bytes

Contents

class GlacierDbArchive < GlacierArchive
  belongs_to :application_data_backup

  before_create do |db_archive|
    db_archive.filename = GlacierDbArchive.filename_from_time
  end

  def self.filename_from_time
    Time.now.strftime("%Y_%m_%d_%H_%M_%S_%L.sql").to_s
  end

  def archive_contents
    ApplicationDatabase.new.contents
  rescue ApplicationDatabase::PostgresAdapter::PgPassFilePermissionsError
    nil
  rescue ApplicationDatabase::PostgresAdapter::PgPassFileMissing
    nil
  rescue ApplicationDatabase::MissingConfigurationKeys
    nil
  end

  # for file archive, true inhibits fetching archive from AWS
  # however we always want to fetch the db archive
  def exists_status?
    false
  end

  def restore
    raise RestoreFail unless ApplicationDatabase.new.restore(backup_file)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glacier_on_rails-0.9.9 app/models/glacier_db_archive.rb