2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Laravel】migration ロールバックコマンド集

2
Posted at

アプリを開発していて、ロールバックすることが増えてきたので備忘録です。

rollback

直前に行ったマイグレーションをなかったことにします。
down()メソッド内の処理を実行。

php artisan migrate:rollback

回数指定

php artisan migrate:rollback --step=[回数]

reset

完全にリセットしたいときに使います。

php artisan migrate:reset

refresh

すべてのマイグレーションをロールバックしてから再びマイグレーションします。

php artisan migrate:refresh

fresh

すべてのテーブルを削除してから再びマイグレーションします。

php artisan migrate:fresh
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?