I have seeded my DB using php artisan db::seed
. Is there a way to rollback what I have seeded into my DB?
I cannot seem to find any command like php artisan db::seed rollback
.
use Undo Seeder for Laravel. When you install UndoSeeder, the following artisan commands are made available: db:seed-undo Undo seeds in the seeds directory. db:seed-refresh Undo seeds run seeds again.
There are two commands that can revert seeds: db:seed:undo:all reverts all seeds, while db:seed:undo --seed [filename] will revert the most recent seed. However, by default, a list of seeders is not stored in a database table like migrations.
How to rollback a specific migration in laravel ? Step 1 : Open database and check migrations table. Step 2 : Change batch number to last number. Step 3 : Run artisan rollback command.
Laravel includes the ability to seed your database with data using seed classes. All seed classes are stored in the database/seeders directory. By default, a DatabaseSeeder class is defined for you. From this class, you may use the call method to run other seed classes, allowing you to control the seeding order.
use Undo Seeder for Laravel.
When you install UndoSeeder, the following artisan commands are made available:
db:seed-undo Undo seeds in the seeds directory.
db:seed-refresh Undo seeds run seeds again.
more Undo-Seeder
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