Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I migrate:refresh a specific table in my database?

I want to migrate:refresh a specific table called scores. I tried this:

php artisan migrate:refresh --path=/database/migrations/scores

but it says nothing to migrate.

like image 698
Arjay Rickzi Z. Espina Avatar asked Feb 12 '26 21:02

Arjay Rickzi Z. Espina


1 Answers

You cannot refresh a single migration if its not the last one, but you can step back in the migrations chain.

Assuming that you have five migrations and your table is at fourth place you can do like this:

php artisan migrate:refresh --step=2

With this command you refresh the last two migrations.

Note that each migration file name contains a timestamp which allows Laravel to determine the order of the migrations.

You can use the --path argument but it should be a directory in wich the command searches for migrations not a single migration file.

If you run:

php artisan help migrate:refresh

You can see all the parameters accepted.

like image 95
dparoli Avatar answered Feb 16 '26 18:02

dparoli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!