December 7, 2016 —John Koster
The migrate
command is used to run migrations against the database. It provides many different options and flags (six in total). The following table lists and explains each of these options and flags.
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. |
--path=PATH | The path to the migrations file. | The default migrations directory is database/migrations/ . |
--pretend | Does not run any migrations and instead displays the SQL queries that would be run. | The default behavior is to run the migrations. |
--seed | Specifying this flag will cause the db:seed command to be executed after the migrations have run. | The default behavior is to not run the db:seed command afterwards. |
--step | Specifying this flag will cause the migration's batch number to be incremented for each migration so that each migration can be rolled back separately from the others. | The default behavior is to give all newly ran migrations the same batch number and not increment the batch for each migration. |
This command performs the same action as the php artisan migrate
command.
∎
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.