11
12

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 5 years have passed since last update.

rails db:migrateに失敗してStandardError: An error has occurred, all later migrations canceledが出た場合の対処方法

Last updated at Posted at 2019-11-27

バージョン
Rails 5.0.1

rails db:migrateコマンドを実行した際に、
タイトルのエラーが出た時の対処方法メモです。

エラーはこちら

# rails db:migrate
== 20191126024458 CreateDataProvisionUserStatuses: migrating ==================
-- create_table(:user_statuses)
rails aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'user_statuses' already exists: ~~~~

対処方法として

テーブルが既に存在していると怒られています。
なので

# rails db:reset

一度リセットしてから再び、

# rails db:migrate

これで解決しました。

参考

Rails:migrateでDBをリセットして最初からつくり直す方法。
https://qiita.com/Atsushi_/items/a230fb7f624d1eebf2f3

11
12
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
11
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?