Sha256: b1a081e60106684ac6af490f8a6a0134fa9bd8fe7e85f7d39378246fe142f422

Contents?: true

Size: 812 Bytes

Versions: 8

Compression:

Stored size: 812 Bytes

Contents

# typed: true
# frozen_string_literal: true

class OpsBackups::BackupDbJob < ApplicationJob
  queue_as :operations

  # perform a full backup of the database
  # @param tag [String] the tag to assign to the backup
  # @param exclude_tables [Array<String>] the list of tables to exclude from the backup
  # @param cleanup_policy [String] the cleanup policy to apply to the backup, one of "retain_tiered_cleanup_policy" or "retain_last_limit_cleanup_policy"
  def perform(options = {})
    exclude_tables = options[:exclude_tables] || []
    tag = options[:tag] || (exclude_tables.empty? ? "db_pg_full" : "db_pg_partial")
    cleanup = options[:cleanup]
    OpsBackups::Backup.new.db_pg_backup(exclude_tables:, tag:)
    OpsBackups::Backup.send("#{cleanup}_cleanup_policy", tag: tag) if cleanup.present?
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ops_backups-0.1.12 app/jobs/ops_backups/backup_db_job.rb
ops_backups-0.1.11 app/jobs/ops_backups/backup_db_job.rb
ops_backups-0.1.9 app/jobs/ops_backups/backup_db_job.rb
ops_backups-0.1.8 app/jobs/ops_backups/backup_db_job.rb
ops_backups-0.1.7 app/jobs/ops_backups/backup_db_job.rb
ops_backups-0.1.4 app/jobs/ops_backups/backup_db_job.rb
ops_backups-0.1.3 app/jobs/ops_backups/backup_db_job.rb
ops_backups-0.1.2 app/jobs/ops_backups/backup_db_job.rb