Safely remove migration In Laravel

前端 未结 9 1881
天涯浪人
天涯浪人 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:06

    I will rather do it manually

    1. Delete the model first (if you don't) need the model any longer
    2. Delete the migration from ...database/migrations folder
    3. If you have already migrated i.e if you have already run php artisan migrate, log into your phpmyadmin or SQL(whichever the case is) and in your database, delete the table created by the migration
    4. Still within your database, in the migrations folder, locate the row with that migration file name and delete the row.

    Works for me, hope it helps!

提交回复
热议问题