php-laravelHow do I roll back a Laravel migration using PHP?
You can roll back a Laravel migration using PHP by using the artisan command. artisan is the command-line interface included with Laravel.
To roll back a migration, you can use the migrate:rollback command. This command will roll back the last "batch" of migrations, which may include multiple migration files.
Example
php artisan migrate:rollback
Output example
Rolled back: 2019_08_19_000000_create_failed_jobs_table
This command will roll back the last batch of migrations, which may include multiple migration files. You can also specify a specific migration to roll back by using the --step option.
Example
php artisan migrate:rollback --step=2
This command will roll back the last two migrations.
You can also roll back all of your migrations by using the migrate:reset command.
Example
php artisan migrate:reset
This command will roll back all of your migrations.
Code explanation
artisan- command-line interface included with Laravelmigrate:rollback- command to roll back the last "batch" of migrations--step- option to specify a specific migration to roll backmigrate:reset- command to roll back all of your migrations
Helpful links
More of Php Laravel
- How do I set up a .gitlab-ci.yml file for a Laravel project using PHP?
- How do I decide between using PHP Laravel and Yii for my software development project?
- How do I configure Xdebug in the php.ini file for a Laravel project?
- How can I get the current year in PHP Laravel?
- How can I access an undefined array key in PHP Laravel?
- How can I set up a Telegram bot using PHP and Laravel?
- How do I generate a QR code using Laravel and PHP?
- How can I use PHP and XML to create a Laravel application?
- How can I use Xdebug to debug a Laravel application written in PHP?
- How can I use XAMPP to develop a project in Laravel with PHP?
See more codes...