Safely remove migration In Laravel

前端 未结 9 1768
天涯浪人
天涯浪人 2021-01-29 17:46

In Laravel, there appears to be a command for creating a migration, but not removing.

Create migration command:

php artisan migrate:make create_users_tab         


        
9条回答
  •  鱼传尺愫
    2021-01-29 18:04

    I agree with the current answers, I just wanna add little more information.

    A new feature has been added to Laravel 5.3 and above version that will allow you to back out a single migration:

    php artisan migrate:rollback --step=1
    

    after, Manually delete the migration file under database/migrations/my_migration_file_name.php

    This is a great feature for when you run a migration

    In this way, you can safely remove the migration in laravel only in 2 step

提交回复
热议问题