Answer the question
In order to leave comments, you need to log in
How to use artisan to migrate:rollback or :refresh just one table?
Maybe my question seems banal, but I really can't google anything about it.
Answer the question
In order to leave comments, you need to log in
It is important to understand that there are only two ways and they both do not fit into the solution methods you proposed.
You can:
Let's take a closer look at the second solution:
The issue is resolved by modifying the `migrations` table in the database.
Change the value of `batch` so that the migration you are looking for is the last migration in the list and is the only one with that value `batch`. Sorting in the `migrations` table is by the `batch` field in ascending order.
After that, you can run the `php artisan migrate:rollback` command, which will rollback the desired migration.
php artisan migrate:rollback --pretend track changes. as an option
In general, if the migrations are scheduled correctly, for example
, users_table
users_table_add_role
users_table_add_is_active
users_table_add_last_visited_at,
then there will be no problems with rollbacks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question