How to roll back the specific migration of Laravel
Learn how to rollback a single Laravel migration with an example.
Laravel provides an easy way to roll back specific migrations. For example, if you want to roll back migration of the users table, you can use the php artisan migrate:rollback --step=1
command. This command will undo the most recent migration, which in this case is the migration of the users table.
Rolling Back Migrations
To roll back specific migrations, you can use the migrate:rollback
command. This command will undo the last migration that was run. For example, if you want to roll back the migration of the users table, you can use the following command:
php artisan migrate:rollback --step=1
This command will undo the most recent migration, which in this case is the migration of the users table. You can also use the migrate:reset
command to undo all migrations that have been run. This command will revert the database back to its initial state.
Additionally, you can also use the migrate:refresh
command to roll back all migrations and then run them again. This is useful if you want to reset the database while keeping the same data.
Finally, you can use the migrate:refresh --seed
command to roll back all migrations and then run them again with the seed data. This is useful if you want to reset the database and add new data.