php artisan migrate:fresh --seed --no-interaction
Reset a Laravel development database, rerun all migrations, seed initial data, and skip interactive confirmation.
The php artisan migrate:fresh --seed --no-interaction command is useful during Laravel development when you want to completely rebuild your database from scratch.
Command Breakdown
migrate:fresh
Drops all existing database tables and runs all Laravel migrations again.
--seed
Runs the DatabaseSeeder after the migrations are completed. This allows you to automatically insert initial or test data.
--no-interaction
Runs the command without waiting for interactive confirmation. This is useful for automated scripts and CI/CD environments.
Execution Flow
Drop all database tables
↓
Run all migrations
↓
Run DatabaseSeeder
↓
Create fresh seed dataExample
php artisan migrate:fresh --seed --no-interactionAfter running the command, your database will contain a newly created schema based on your migrations and any data defined in your seeders.
Warning
This command deletes all existing data from the database.
Use it primarily for local development and testing. Avoid running it on a production database unless you intentionally want to destroy and rebuild the entire database.
When to Use
After changing database migrations during development
When you want a clean database
When testing database seeders
When preparing a fresh development environment
When resetting test data