Class: OpsBackups::BackupDbJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- OpsBackups::BackupDbJob
- Defined in:
- app/jobs/ops_backups/backup_db_job.rb
Overview
typed: true frozen_string_literal: true
Instance Method Summary collapse
-
#perform(options = {}) ⇒ Object
perform a full backup of the database.
Instance Method Details
#perform(options = {}) ⇒ Object
perform a full backup of the database
11 12 13 14 15 16 17 18 |
# File 'app/jobs/ops_backups/backup_db_job.rb', line 11 def perform( = {}) exclude_tables = [:exclude_tables] || [] tag = [:tag] || (exclude_tables.empty? ? "db_pg_full" : "db_pg_partial") cleanup = [:cleanup] Rails.logger.info "Performing backup with tag: #{tag} and exclude_tables: #{exclude_tables}" OpsBackups::Backup.new.db_pg_backup(exclude_tables:, tag:) OpsBackups::Backup.send("#{cleanup}_cleanup_policy", tag: tag) if cleanup.present? end |