Home > front end >  how to roll back Laravel command
how to roll back Laravel command

Time:09-18

I have run the following Laravel command PHP artisan make: migration add_category_id_to_posts but I need to run the following command as well PHP artisan make: migration add_category_id_to_posts --table=posts then I need to roll back the first command and run the second command. then How?

CodePudding user response:

go to your database/migration/your migration delete the migration you recently created, and then run the command again like so:

php artisan make:migration add_category_id_to_posts --table=posts.

note: you can rollback your migrations if you migrate your migrations on the command : php artisan migrate then you can rollback by php artisan migrate:rollback

CodePudding user response:

As mentioned by Fatima Mazhit, this command cannot be rolled back.

Simply delete the newly created add_category_id_to_posts migration file and run php artisan make:migration add_category_id_to_posts --table=posts.

CodePudding user response:

You need to delete the earlier created migration manually and run the same command again after making appropriate changes in your migration. Or simply run php artisan migrate:rollback, will do your task.

  • Related