Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

This module automates database backups for Drupal sites and manages them with a four-tier retention policy to save storage space and ensure recovery flexibility. It can optionally send email notifications, compress backups, integrate with Git to track code changes, and even encrypt sensitive data.

⚠️ Status: Pre-Release (Development Version)

This module is in active development. While functional and safe for testing in development environments, it is NOT recommended for production use until the first stable (1.0) release. The stable release will include security audits and official support commitments.

For production use: Please check back on this project page for the stable 1.0 release.

Automated database backups for Drupal with a sophisticated 4-tier retention policy. Designed for flexible backup management with optional email notifications.

Key Features

  • Automated daily backups via Drupal cron
  • 4-Tier intelligent retention strategy (recent, monthly, quarterly, yearly)
  • Optional email notifications to configured recipients
  • Gzip compression to save disk space
  • Git integration - backup filenames include branch name and commit hash
  • Install folder synchronization for codebase distribution
  • Optional GPG encryption for sensitive backups
  • Comprehensive logging to Drupal watchdog

How It Works

4-Tier Retention Strategy

  • Tier 1 (Recent): Keep all backups from last 2 days
  • Tier 2 (Monthly): Keep 1 snapshot from 2-30 days ago
  • Tier 3 (Quarterly): Keep 1 snapshot from 1-6 months ago
  • Tier 4 (Yearly): Keep 1 snapshot from 6-12 months ago

This strategy balances storage, recovery flexibility, and disaster recovery capability.

Use Cases

Best for:

  • Development and testing environments
  • Quick recovery from recent database changes
  • Teams tracking code-database alignment with commit hashes
  • Organizations distributing database snapshots within the repository
  • Simple, focused backup needs (database only)

Complete Backup Strategy (Recommended)

For comprehensive site protection, use these three components together:

Component Purpose What's Protected Git Version control Code, modules, themes, configs Retention Database Backup Database backups Database with 4-tier retention Restic Backup File protection User uploads, private files

Together, these three provide complete coverage for disaster recovery. No Backup & Migrate needed when using this combination.

Installation

Requirements

  • Drupal 10.x or 11.x
  • Drush 13.x+ (must be installed and in system PATH)
  • PHP 8.1+
  • Git repository (optional but recommended)

Setup Steps

  1. Place the module in web/modules/custom/retention_database_backup/
  2. Enable: drush pm:enable retention_database_backup
  3. Configure at /admin/config/system/retention-database-backup

Configuration

Email Notifications (Optional)

  • Enter recipient email addresses (one per line or comma-separated)
  • Newly added recipients receive a welcome email
  • Specify a "From" email address for replies

GPG Encryption (Optional)

  • Enable for sensitive backup protection
  • Set up GPG key on the server
  • Configure recipient email in settings

Install Folder Sync (Optional)

  • Automatically sync latest backup to install/ folder
  • Useful for distributing database snapshots with codebase
  • Configure folder path in settings

Similar Projects: Comparison with Backup & Migrate

While both modules handle database backups, they serve different purposes and use different approaches. The recommended strategy combines this module with Restic Backup and Git for comprehensive coverage. See the comparison below to understand which approach is best suited to your needs.

Feature Retention DB Backup Backup & Migrate Automated Daily Backups ✓ Yes ✓ Yes (via UI) Retention Policy ✓ 4-Tier custom-designed ✓ Customizable Git Integration ✓ Commit hash in filename ✗ No Email Notifications ✓ Yes ✓ After every backup GPG Encryption ✓ Optional ✓ Optional

When to Use Retention Database Backup

Choose this module if you:

  • Want database backups with intelligent, low-overhead retention
  • Track code-database alignment with commit hashes
  • Need frequent backups for quick recovery
  • Prefer a focused, minimal solution
  • Already use Git for code protection

Pair with: Restic Backup for complete file protection. Use Git (code) + Retention Database Backup (database) + Restic Backup (files) together.

Drush Commands

drush retention-db:backup - Create backup manually

drush retention-db:list - List existing backups

drush cron - Run automated backups via cron

Documentation & Support

For detailed configuration, troubleshooting, and advanced features, refer to the README.

AI Disclosure

This module was generated using AI assistance (Claude AI). The code, documentation, tests, architecture, and all features were created through an AI-driven development process. While thoroughly reviewed and tested, this disclosure provides transparency about the development methodology.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Feb 2026
Latest release
6 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
1.0.x-dev Dev 10–11 Feb 12, 2026