Sometimes we need to refresh only a specific table, here I am showing all the artisan command both refresh all table and a specific table

For All tables, the command will be like below.

php artisan migrate:refresh

For a specific table, command will like below

php artisan migrate:refresh –path=/database/migration/2023_06_30_162904_create_blog_categories_table.php

As we can see in the above artisan command, we just need to declare the –path for the migration. It will show that all other migrations are not found in the given path. It only found one migration and rollback and migrated successfully.

It may seem like an error in red colour but it is not the error it just says that other migrations are not found in the given path but that’s ok. We only need to refresh single migration that’s why we defined the path.

Delete the specific table

php artisan migrate:rollback --path=/database/migrations/fileName.php

Refresh

php artisan migrate:refresh --path=/database/migrations/fileName.php

Seeder

php artisan db:seed --class=classNameTableSeeder

 

Leave a Comment
No Comments found