ludovicguenet/whizbang

Whizbang β€” Automatic database schema change tracking, risk analysis, and instant rollback for Laravel.

dev-main 2025-08-12 13:10 UTC

This package is auto-updated.

Last update: 2025-08-12 13:10:31 UTC


README

Whizbang Logo

πŸ›‘οΈ Whizbang – Laravel Database Safety Package

The ONE thing Laravel is desperately missing that EVERY developer needs! Automatic database schema change tracking, safety analysis, and instant rollback system for Laravel migrations.

PHP Version Require Laravel Version License

Installation β€’ Quick Start β€’ Features β€’ Commands β€’ Use Cases β€’ Contributing

⚠️ Production Safety Tool: Whizbang is designed to protect live databases. Use it in development and production to prevent irreversible data loss.

πŸ’₯ The Problem

  1. You run php artisan migrate in production.
  2. Migration drops a column with important data β†’ GONE FOREVER.
  3. App breaks β†’ NO EASY WAY BACK.
  4. Boss asks "What changed?" β†’ Β―\(ツ)/Β―

Laravel migrations are one-way by default. Once destructive changes happen, there’s no built-in recovery or audit trail.

βœ… The Solution: Whizbang

An automatic safety net for database changes that Laravel doesn’t provide.

✨ Key Features

  • πŸ“Έ Auto-Snapshots – Capture schema before every migration
  • πŸ›‘οΈ Danger Detection – Warn about risky operations (DROP TABLE, DROP COLUMN, etc.)
  • πŸ”„ Rollback Flow – Execute a rollback procedure with safety checks; table recreation steps are currently logged (scaffold), not auto-applied
  • ⚑ Risk Analysis – Calculate rollback safety before executing
  • πŸ“Š Change Tracking – Complete audit trail of what changed and when

🚨 Real-World Example

php artisan migrate
# πŸ“Έ Pre-migration snapshot saved (ID: 123)
# ⚠️  DANGEROUS CHANGES DETECTED!
# ❌ Column 'users.email' was dropped (Risk: HIGH)
# πŸ”„ To rollback, use: php artisan schema:rollback 123

πŸ“‹ Requirements

  • PHP 8.2+
  • Laravel 11.0+
  • Database supported by Laravel Migrations

πŸ“¦ Installation

Install Package

composer require ludovicguenet/whizbang

Publish Config

php artisan vendor:publish --tag=whizbang-config

Run Migrations

php artisan migrate

πŸš€ Quick Start

Manual Snapshot

php artisan schema:snapshot --reason="before-hotfix"

Risk Analysis

php artisan schema:status
# Recent Snapshots:
# ID  | Reason        | Created At          | Tables
# 123 | pre_migration | 2024-08-11 10:30:00 | 15
# 122 | manual        | 2024-08-11 09:15:00 | 15

Rollback Flow

php artisan schema:rollback 123
# ⚠️  You are about to rollback your database schema!
# βœ… Rollback safety check passed
# Are you absolutely sure? (yes/no): yes
# βœ… Rollback flow executed. Table recreation steps were logged (no destructive actions applied automatically)

βš™οΈ Commands

# Take a snapshot
php artisan schema:snapshot --reason="before-release"

# Check status and history
php artisan schema:status

# Rollback to a snapshot
php artisan schema:rollback 123

# Force rollback (skip safety checks)
php artisan schema:rollback 123 --force

🎯 Use Cases

  • Production Deployments – Auto-snapshot before migrations
  • Hotfixes – Quick rollback when things go wrong
  • Schema Auditing – Track all database changes
  • Team Safety – Prevent dangerous operations
  • Compliance – Maintain schema change history

❓ Why This Doesn’t Exist in Laravel

Laravel focuses on forward migrations, but offers no built-in way to:

  • Track actual schema changes
  • Analyze safety of those changes
  • Rollback schema changes without full backups
  • Warn about dangerous operations

Every Laravel developer has been burned by this. Whizbang closes that gap.

🀝 Contributing

We welcome contributions!

git clone https://github.com/ludoguenet/whizbang.git
cd whizbang
composer install
vendor/bin/pest

πŸ“œ License

Whizbang is open-source software licensed under the MIT License.

πŸ”’ Security

If you discover security vulnerabilities, please email ludo@epekta.com instead of using the issue tracker.

πŸ›‘οΈ Made with ❀️ by Ludovic GuΓ©net for the Laravel community πŸ›‘οΈ

Website β€’ Support