如何回滚Laravel命令

12 浏览
0 Comments

如何回滚Laravel命令

我已经运行了以下 Laravel 命令 PHP artisan make: migration add_category_id_to_posts,但我还需要运行以下命令 PHP artisan make: migration add_category_id_to_posts --table=posts,然后我需要回滚第一个命令并运行第二个命令。那么怎么做?

admin 更改状态以发布 2023年5月24日
0
0 Comments

您需要手动删除先前创建的迁移,然后在迁移中进行相应更改后再次运行相同的命令。或者只需运行 php artisan migrate:rollback,即可完成任务。

0
0 Comments

正如Fatima Mazhit所提到的那样,这个命令无法回滚。

只需删除新创建的add_category_id_to_posts迁移文件,然后运行php artisan make:migration add_category_id_to_posts --table=posts

0