Tuesday, 20 April 2021

Laravel roll back migrations

 Method A

Go to "migrations" table delete migration row history entry

Drop table 

command: composer dump-autoload AND php artisan config:cache (Make laravel refetch "migration" table, so it knows the migration already run, has no effect with command below, but for future php artisan migrate)

php artisan migrate --path=/database/migrations/myMigration.php




Method B

php artisan migrate:refresh 

(This checks your current DB "migrations" table and roll back every migration row history entry and re run migration)

https://stackoverflow.com/questions/50837543/how-to-re-migrate-a-laravel-migration-after-deleting-the-table/50837595#:~:text=IF%20you%20want%20to%20re,if%20you%20have%20any%20seeder.



No comments:

Post a Comment