Laravel How to Migrate and Seed specific Table
Hello Artisans, Today I'll talk about how you can migrate & seed specific table. Sometimes you may run to a condition where you've to migrate/seed your specific table. From this today tutorial, you'll get a tip on how you can migrate/rollback/refresh/seed your specific table.
Fire the below command in your terminal to migrate the specific table
php artisan migrate --path=/database/migrations/filename.php
It'll migrate the your filename migration.
Even you can migrate your specific table from one folder from the below command.
php artisan migrate --path=/database/migrations_demo
It'll migrate all your migrations under database/migrations_demo.
Fire the below command to rollback your specific table.
php artisan migrate:rollback --path=/database/migrations/filename.php
It'll rollback your filename table.
Fire the below command to refresh your specific table.
php artisan migrate:refresh --path=/database/migrations/filename.php
It'll refresh your filename table.
Fire the below command to seed your specific table.
php artisan db:seed --class=classNameTableSeeder
It'll seed your specific table/tables under the given class.
That's it for today. Hope you've enjoyed this tutorial. Thanks for reading. 🙂