Download the PHP package tarunkorat/laravel-migration-squasher without Composer
On this page you can find all versions of the php package tarunkorat/laravel-migration-squasher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tarunkorat/laravel-migration-squasher
More information about tarunkorat/laravel-migration-squasher
Files in tarunkorat/laravel-migration-squasher
Package laravel-migration-squasher
Short Description Squash old Laravel migrations into a single schema file
License MIT
Informations about the package laravel-migration-squasher
Laravel Migration Squasher
Squash old Laravel migrations into a single schema file to keep your migrations folder clean and manageable.
Fully compatible with Laravel 8, 9, 10, 11, and 12!
โจ Features
- ๐๏ธ Squash old migrations into a single schema file
- ๐ Keep recent migrations separate for easy tracking
- ๐ Safe backup before any deletion
- ๐ Faster migrations - reduce migrate:fresh time by 90%
- ๐ฏ Laravel 8-12 compatible - works with all modern Laravel versions
- ๐ Dry run mode - preview changes before applying
- ๐ก๏ธ Database agnostic - works with MySQL, PostgreSQL, SQLite, SQL Server
- ๐ Clean codebase - reduce migration clutter from 100+ to just a few files
๐ Requirements
- PHP 8.0 or higher
- Laravel 8.x, 9.x, 10.x, 11.x, or 12.x
- Doctrine DBAL (automatically installed)
๐ฆ Installation
Install the package via composer:
The package will automatically register itself via Laravel's package discovery.
Publish Configuration (Optional)
This will create config/migration-squasher.php file.
๐ Usage
Basic Usage
Squash all migrations before a specific date, keeping the 10 most recent:
Preview Changes (Dry Run)
See what would be squashed without making any changes:
Custom Options
โ๏ธ Configuration
The config file provides several options:
๐ Before & After Example
Before Squashing
Total: 100 migration files ๐ฐ
After Squashing
Total: 4 migration files ๐
๐ฏ When to Use This Package
โ Perfect For:
- Long-running projects (1+ years old with 50+ migrations)
- Performance optimization (speed up
migrate:freshby 90%) - Team onboarding (new developers see clean migration history)
- CI/CD pipelines (faster test suite execution)
- Before major releases (clean slate for v2.0)
โ Not Recommended For:
- New projects (< 6 months old with few migrations)
- Active feature branches (wait until merged to avoid conflicts)
- Projects that never run
migrate:fresh
๐ง How It Works
- Analyzes all migrations in your project
- Identifies migrations older than specified date
- Keeps the most recent N migrations separate
- Generates a schema dump from your current database structure
- Creates backup of squashed migrations (optional)
- Deletes old migration files
- Updates migrations table (optional)
Important Notes
- โ Your database stays exactly the same - no data is modified
- โ Only migration files are affected
- โ Always creates backups before deletion (unless disabled)
- โ Safe to run - uses dry-run mode first
๐งช Testing
๐ Performance Comparison
| Metric | Before Squash | After Squash | Improvement |
|---|---|---|---|
| Migration Files | 167 files | 11 files | 93% reduction |
migrate:fresh Time |
8 minutes | 45 seconds | 90% faster |
| CI/CD Pipeline | 2 min migrations | 30 sec migrations | 75% faster |
| Codebase Clarity | Cluttered | Clean | Much better |
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ Changelog
Please see CHANGELOG for more information on what has changed recently.
๐ Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
๐ License
The MIT License (MIT). Please see License File for more information.
๐ก Credits
- Tarun Korat
- All Contributors
๐ Support
If you find this package helpful, please consider:
- โญ Starring the repository
- ๐ Reporting bugs and issues
- ๐ Contributing to documentation
- ๐ฌ Sharing with other Laravel developers
Made with โค๏ธ for the Laravel community
All versions of laravel-migration-squasher with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/console Version ^8.0|^9.0|^10.0|^11.0|^12.0
doctrine/dbal Version ^3.0|^4.0