Sometimes while working on a laravel application, we just need to migrate only single or specific migration. If we run normal migrate command it will migrate all the migrations written in the application. Here i will let you know to migrate single migration in laravel.
Migrations play very important role for aplication’s database structure. We just need to create migrations in the application for each table which you want and whenever we migrate these migrations. New table structure would be created.
For new developers or setting up new environment, we do not need to backup of table structure. We will just need to run the migrations. It will automatically create desired tables in the database connected from the laravel application.
We can run all the migrations using the command below.
php artisan migrate
Now if we want to run only one migration or a specific migration, we will need to define a path parameter and will need to specify the path of that migration file which we want to run like below.
php artisan migrate --path=/database/migrations/my_migration.php
It will migrate only my_migration.php file. Here, you will need to replace file name from your own migration file.
You can also learn how to add column in existing daatbase table through migration by clicking on the below.
#laravel #how to migrate single migration file #laravel migration #laravel single migration #migrate specific migration in laravel