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でテーブルの削除

Posted at

mastersテーブルを削除してみる。
テーブルを削除するためのマイグレーションファイルを作成する。

マイグレーションファイル作成

$ rails g migration masters

マイグレーションファイル編集

class Masters < ActiveRecord::Migration[6.0]
  def change
    drop_table :masters
  end
end
$ rails db:migrate

でテーブルの削除ができます。

参考:https://qiita.com/kanuu/items/a9223712ee0ff8d19d56
https://k-koh.hatenablog.com/entry/2020/08/18/103826

開発環境
mac OS バージョン11.6
エディタ
VScode

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?