database-backup

Automate pre-migration database backups with Spatie Laravel Backup.

Updated Oct 26, 2025
One-click install
npx skills add https://github.com/Hieubkav/wincellarCloneBackend --skill database-backup-hieubkav
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-backup
Source: https://github.com/Hieubkav/wincellarCloneBackend/tree/main/.claude/skills/database-backup
Command: npx skills add https://github.com/Hieubkav/wincellarCloneBackend --skill database-backup-hieubkav

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires spatie/laravel-backup.

What problem does it solve?

Database migrations are critical but risky operations that can lead to data loss if not handled carefully. This skill enforces a mandatory pre-migration backup workflow, ensuring your data is always protected and providing a clear path to restore in case of errors.

Core Features & Use Cases

  • Mandatory Pre-Migration Backup: Automates database backups using Spatie Laravel Backup before any schema changes.
  • Restore Workflow: Provides clear instructions for restoring your database from a backup if a migration fails.
  • Schema Documentation: Guides you to update mermaid.rb to keep your database schema documentation in sync with changes.
  • Use Case: Before running php artisan migrate to deploy a new feature, activate this skill to automatically perform a database backup, ensuring you can easily revert if the migration introduces unexpected issues.

Quick Start

I'm about to run a database migration. Perform a database-only backup for me.

Frequently Asked Questions about database-backup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate database backups before running Laravel migrations?

Database backups before migrations protect against data loss during schema changes. This skill automates backup generation using Spatie Laravel Backup via `php artisan backup:run --only-db`, storing timestamped backups in `database/backups/Laravel` with a 10-backup retention limit, ensuring you can restore if a migration fails.

What's the best way to safeguard data before applying schema changes in Laravel?

Pre-migration backups are the safest approach for schema changes. This skill enforces mandatory database-only backups before migrations, maintaining concise, descriptive filenames and automatic cleanup, so you have a clear restore path if unexpected issues arise.

Can I use Spatie Laravel Backup to protect database migrations?

Yes. Spatie Laravel Backup supports database-only backups through the `backup:run --only-db` command. This skill integrates Spatie backups into your pre-migration workflow, automating the backup step and managing storage with timestamped filenames and retention policies.

How do I restore a database after a failed migration in Laravel?

After a failed migration, locate your timestamped backup in `database/backups/Laravel` and follow the restore instructions provided by this skill. It documents the restoration process to help you recover your database to its pre-migration state safely.

Do I need to manually manage database backups before each Laravel migration?

No. This skill automates the entire pre-migration backup workflow, eliminating manual steps. It enforces backups using Spatie Laravel Backup, manages storage and retention automatically, and updates schema documentation post-migration.

How does this skill keep database schema documentation in sync with migrations?

After migrations complete, this skill guides you to update `mermaid.rb` schema documentation to reflect your database changes, ensuring your schema records stay current and accurate alongside your code migrations.