マイグレーションを実行すると、下記のようにエラー発生
$rails db:migrate
テーブルが重複しているらしい。
〇〇$ rails db:migrate
== 20201118030648 CreateUpdates: migrating ====================================
-- create_table(:updates)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DuplicateTable: ERROR: relation "updates" already exists
$rails db
#実行結果
アプリ名_development=#
#以降でコマンドを入力できるようになる。\dを入力する。
アプリ名_development=#\d
#実行結果 存在するテーブルの一覧が表示される
Schema | Name | Type | Owner
--------+-----------------------------------+----------+-------
public | updates | table | ユーザー名
public | updates_id_seq | sequence | ユーザー名
(40 rows)
今回はupdateテーブルが不要なので、削除してやる。
#table以下は消したいテーブル名とする
アプリ名_development=#drop table updates;
#実行結果
DROP TABLE
これで削除できたはずですが、もう一度『\d』で確認
アプリ名_development=#\d
#updateテーブルが削除されている
コメントを残す