December 7, 2016 —John Koster
The migrate:status
command can be used to check the status of each migration. The command will output a table that lists each migration and an indicator of whether or not the migration has been ran. The migrate:status
command provides a few options to check the status of migrations on other database connections and in different locations. The following table lists the 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. |
--path=PATH |
The path to the migrations file. | The default migrations directory is database/migrations/ . |
The following example demonstrates how to use the migrate:status
command:
1# Run the command with defaults.2php artisan migrate:status3 4# Run the command while specifying the database connection name.5php artisan migrate:status --database=mysql6 7# Run the command while specifying the migrations path.8php artisan migrate:status --path=database/migrations
The migrate:status
command will output a generated table similar to the following output. A Ran?
value of N
indicates that the migration has not ran and a value of Y
indicates that the migration has ran.
1+------+------------------------------------------------+2| Ran? | Migration |3+------+------------------------------------------------+4| N | 2014_10_12_000000_create_users_table |5| N | 2014_10_12_100000_create_password_resets_table |6+------+------------------------------------------------+
∎
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.