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!
IF you want to re-migrate all the database, you can simply do: php artisan migrate:refresh . IF you want to make sure your database to be clean with your latest changes, you can drop your entire database tables and do php artisan migrate again. Also, you can try php artisan migrate --seed if you have any seeder.
php artisan migrate:fresh is used when we want a fresh or new installation of our database. It deletes all the existing tables of the database and runs the migrate command. php artisan migrate:refresh is a two in one command that executes the :rollback command and the migrate command.
The migrate:refresh command is used to rollback all the migrations and then re-run the migrations. Basically, it is used to re-create the entire database.
You should add the path to your migration file to refresh just this table and run
php artisan migrate:refresh --path=/database/migrations/my_migration.php
if you need rollback:
php artisan migrate:rollback --path=/database/migrations/my_migration.php
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
php artisan migrate:refresh
command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With