Mr. J
Mr. J

Reputation: 245

How to migrate:rollback a specific table in laravel 5

I know this feature has been already added in laravel 5.3, but I am using Laravel 5.1, how can I do it using 5.1 version? I've also searched it on internet, but there's only solution for 5.3. Hope you can help me, and for those who have the same problem.

Upvotes: 1

Views: 6755

Answers (2)

Blues Clues
Blues Clues

Reputation: 1848

You can just edit the batch of your migration, update it as last migration. For example, if the batch of the table is 73 and you already have 74 & 75 you can just UPDATE migrations SET batch = 76 WHERE batch = 73, now your table's batch is 76, RUN php artisan migrate:rollback , and there you go.

Upvotes: 8

Sandeesh
Sandeesh

Reputation: 11916

You can't rollback a specific table even in the latest version (5.4) of laravel. You can only rollback a particular migration. This question was asked recently and there a couple of answers which apply to 5.1 as well.

Rollback a specific migration in laravel5

If you are indeed talking about rolling back a specific migration then do this.

https://stackoverflow.com/a/30288058/5892849

https://stackoverflow.com/a/44100120/5892849

Upvotes: 0

Related Questions