I
I
Ivan Tokar2015-10-22 13:18:13
Laravel
Ivan Tokar, 2015-10-22 13:18:13

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

2 answer(s)
A
Alexey Karagodnikov, 2015-10-22
@Jonathan

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.

R
Rustamka Vorontsov, 2015-10-22
@rmfordev

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 question

Ask a Question

731 491 924 answers to any question