spatie/laravel-migrate-fresh
Adds a migrate:fresh Artisan command to drop all database tables and rebuild from migrations, even if you don’t implement down() methods. Supports MySQL, SQLite, PostgreSQL, and SQL Server. (Built into Laravel 5.5+)
down() method support in migrate:refresh).migrate:fresh (introduced in Laravel 5.5+), making this package redundant unless targeting older Laravel versions (<5.5).down() methods. Modern Laravel projects often include reversible migrations, reducing the package’s utility.migrate:fresh (and later migrate:fresh --seed) obviates the need for this package.migrate:fresh?
down()-less migrations?
down() methods, or accept the package’s destructive approach?migrate:fresh is superior.down() method coverage.spatie/laravel-migration-snapshots if using rollback testing).composer require spatie/laravel-migrate-fresh.AppServiceProvider.migrate:refresh with migrate:fresh in deployment scripts.php artisan migrate:fresh --seed instead.#!/bin/bash
if [ "$(php -r 'echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;')" -lt "80" ]; then
php artisan migrate:fresh
else
php artisan migrate:fresh --seed
fi
db:seed if needed (not native to this package).nunomaduro/collision).| Scenario | Impact | Mitigation |
|---|---|---|
| Migration fails midway | Partial schema corruption | Backup + manual cleanup |
| Database connection | Command hangs/timeout | Retry with connection pooling |
| Custom migration logic | Unexpected behavior | Test in staging first |
| Laravel version mismatch | Command not found | Fork and update dependencies |
php artisan migrate:fresh is simple.migrate:fresh wrappers.Doctrine\DBAL).How can I help you explore Laravel packages today?