ludovicguenet/whizbang
Composer 安装命令:
composer require ludovicguenet/whizbang
包简介
Whizbang — Automatic database schema change tracking, risk analysis, and instant rollback for Laravel.
README 文档
README
🛡️ 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.
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
- You run
php artisan migratein production. - Migration drops a column with important data → GONE FOREVER.
- App breaks → NO EASY WAY BACK.
- 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 🛡️
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-11