Laravel Artisan Migration Command: The migrate:reset Command

December 7, 2016 —John Koster

The migrate:reset command can be used to roll back all the migrations in your application. The migrate:reset command provides a few options that can be used to customize the behavior of the reset. The following table lists and explains the various options that are available for use.

Option/Flag Description Default Value
--database=CONNECTION_NAME The name of the database connection to use. These can be found in the databases.connections configuration entry. Assumes the value of the of the DB_CONNECTION environment variable, or mysql if no value has been set.
--force Forces the migrations to run in a production environment. Default behavior is to not run migrations in a production environment.
--pretend Does not run any migrations and instead displays the SQL queries that would be run. The default behavior is to run the migrations.

The following examples demonstrate how to use the migrate:reset command:

1# Call the command with defaults.
2php artisan migrate:reset
3 
4# Call the command while specifying the connection name.
5php artisan migrate:reset --database=mysql
6 
7# Reset the migrations on a production environment.
8php artisan migrate:reset --force
9 
10# Do not perform any actual database operations and simply show
11# the SQL queries that would have been performed.
12php artisan migrate:reset --pretend

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.