我已經運行了以下Laravel命令 PHP artisan make: migration add_category_id_to_posts 但是我還需要運行以下命令 PHP artisan make: migration add_category_id_to_posts --table=posts 然后我需要回滾第一個命令并運行第二個命令。那么如何?
uj5u.com熱心網友回復:
進入你的資料庫/遷移/你的遷移。 洗掉你最近創建的遷移,然后像這樣再次運行命令:
php artisan make:migration add_category_id_to_posts --table=posts.
注意:你可以通過以下命令回滾你的遷移:php artisan migrate然后你可以通過php artisan migrate:rollback
uj5u.com熱心網友回復:
正如Fatima Mazhit所提到的,這個命令不能回滾。
簡單地洗掉新創建的add_category_id_to_posts遷移檔案,然后運行php artisan make:migration add_category_id_to_posts --table=posts。
uj5u.com熱心網友回復:
你需要手動洗掉先前創建的遷移,并在遷移中做適當的修改后再次運行相同的命令。或者簡單地運行php artisan migrate:rollback,就可以完成你的任務。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/320591.html
標籤:
