0
0

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 1 year has passed since last update.

Rails on Ruby テーブルをupからdownにする方法

Last updated at Posted at 2022-07-13

※Rails 6.1.6

rails db:migrate:statusでテーブルがupかdownかを確認できる。

Status   Migration ID    Migration Name
--------------------------------------------------
   up     20220355345534  Devise create customers
   up     20220353343534  Devise create admins

今回はcustomersテーブルをdownにします。

rails db:migrate:down VERSION=20220355345534

もう一度db:migrate:statusで確認すると....

Status   Migration ID    Migration Name
--------------------------------------------------
  down    20220355345534  Devise create customers
   up     20220353343534  Devise create admins

まとめ

rails db:migrate:down VERSION="downにしたいテーブルのMigration IDをここに入れる" これでupからdownにできます。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?