Laravel migrate specific table

Run a specific migration file in Laravel.

In some cases you need to run only one migration file in Laravel without affecting or creating other tables. So let's first create a new migration file to create a new table for our application members:

Create the migration file

php artisan make:migrate create_members_table

The command above will create a new file with the name YYYY_MM_DD_HHMMSS_create_members_table.php in database/migrations folder.

Run the migration file

In case you need to run only this specific migration file you can use the --path options in your CLI. The command to run the migration file we just created is the following:

php artisan migrate --path=database/migrations/YYYY_MM_DD_HHMMSS_create_members_table.php

If the command run successfully then a new table called member will be in your database.