Drupal is a registered trademark of Dries Buytaert

⚠️ 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.

Activity

Total releases
1
First release
Feb 2026
Latest release
2 weeks ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.x-dev Dev Feb 12, 2026