I
I
Ivan Ivanov2019-03-30 20:02:13
Laravel
Ivan Ivanov, 2019-03-30 20:02:13

How to remigrate a single Laravel table?

Only the users table needs to be migrated. Can this be done somehow?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy Samoilenko, 2019-03-30
@samoilenkoevgeniy

In your case, there are two ways to do it:
1. Write a new migration in which you change the structure of the desired table and do php artisan migrate
2. "Reroll" all migrations again by killing the current structure (Attention, data loss)
Well, and most importantly - good to read what migrations are and what they are used for.

A
Alex Wells, 2019-03-30
@Alex_Wells

No way. Migrations can NOT be changed after production, only new ones can be written. Actually, that's the point.
Again, if before the sale, do migrate:fresh --seed
If after the sale, create a NEW migration, like alter_users_table_add_avatar, inside Schema::table() and go.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question