You need to specific table migration in Laravel because you don’t want to drop or trunk the existing data within the tables or for some other reasons you just don’t want to play with the database.
Create a migration first
Open your terminal and run this command.
1 |
php artisan make:migration create_mrasta_table |
Create a new folder in migrations
Here you will need to create a new folder within the migrations folder, for now let’s create a new folder labeling as ‘ mrasta ‘
Move your file
You need to move your newly created migration file to the newly created folder (mrasta)
[[ find how to redirect unauthorized user access to 403 custom page ]]
Open the terminal once again and finally hit the below command
1 |
php artisan migrate --path=/database/migrations/mrasta |
or
1 |
php artisan migrate:refresh --path=/database/migrations/mrasta |
By running the above migrate command, it will only migrate the newly created files within the specified directory which you have created, in the above example the command will migrate all of the files in “mrasta folder”.
Wrapping up Specific Table Migration in Laravel
That is how we do migrate a specific table in Laravel, if you still face any trouble, let us know in the comment section. We will get back to you as soon as possible.