Your destination for complete Tech news

How to run specific migration in Laravel?

4.74K 0
< 1 min read

To run a specific migration in Laravel, you can use the migrate Artisan command with the --path option and specify the path to the migration file.

For example, if you have a migration file located at database/migrations/2018_01_01_000001_create_users_table.php, you can run the following command to migrate this specific migration:

php artisan migrate --path=database/migrations/2018_01_01_000001_create_users_table.php

You can also use the --force option to force the migration to run even if it has already been run before:

php artisan migrate --path=database/migrations/2018_01_01_000001_create_users_table.php --force

Running a migration with the --force option will skip any database check for the migration having already run and could potentially cause issues if the migration has already run and modified the database.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.