Railsにテーブルをドロップして最初からやり直す方法を探していたところ、次の答えに出くわしました:Rails DBの移行-テーブルをドロップする方法は?
ただし、実行するdrop_table :examples
と、次のエラーが発生しました。
-bash: drop_table: command not found
これが私のcreate_examples
移行ファイルです:
def self.down
drop_table :examples
end
誰かが私をこれを修正するように導き、私が間違っていることについての洞察を私に与えるのを手伝ってもらえますか?この特定の移行により、が実行できなくなりrake db:migrate
、次のエラーが発生するため、修正する必要があります。
== CreateExamples: migrating ====================================================
-- create_table(:examples)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "examples" already exists: CREATE TABLE "examples" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" varchar(255), "user_id" integer, "created_at" datetime, "updated_at" datetime)
ありがとう!(さらにコードを提供する必要がある場合は、お知らせください。)