8

Can I run php artisan migrate:refresh for specific table? Or can I refresh specific table migration in general?

I tried this:

php artisan migrate --path=/database/migrations/selected/

But it's not working!

CairoCoder
  • 3,091
  • 11
  • 46
  • 68
  • Maybe this one can help you? https://laracasts.com/discuss/channels/laravel/how-to-execute-a-specific-table-migration – Abdul Rahman A Samad Nov 08 '17 at 01:57
  • Does this answer your question? [Laravel Migrate Specific File(s) from Migrations](https://stackoverflow.com/questions/45473624/laravel-migrate-specific-files-from-migrations) – miken32 Nov 18 '22 at 17:31

2 Answers2

7

For Specific File run this command:

php artisan migrate:refresh --path="database\migrations\Your_Migration_File_Name_table.php"

Here --file= is for location of your file and migrate:refresh will empty your table data

If you want to empty all table's data from database then run

php artisan migrate:refresh command.
Tuhin
  • 332
  • 3
  • 7
-1

This works for me:

The --table and --create options may also be used to indicate the name of the table and whether the migration will be creating a new table. These options pre-fill the generated migration stub file with the specified table

php artisan make:migration create_users_table --create=users
php artisan make:migration add_votes_to_users_table --table=user

Source: https://laravel.com/docs/5.6/migrations

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
Magige Daniel
  • 1,024
  • 1
  • 10
  • 10