Refresh laravel migration for specific table
Asked Answered
J

2

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!

Jessee answered 8/11, 2017 at 1:41 Comment(3)
Maybe this one can help you? laracasts.com/discuss/channels/laravel/…Allegra
Does this answer your question? Laravel Migrate Specific File(s) from MigrationsAmulet
Does this answer your question? Running one specific Laravel migration (single file)Amulet
F
10

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.

Flannel answered 2/9, 2021 at 15:55 Comment(0)
B
-2

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

Brodeur answered 22/8, 2018 at 8:11 Comment(1)
The is not what OP has asked, technically correct answer but does not remotely relate to the question in hand.Willetta

© 2022 - 2024 — McMap. All rights reserved.