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

rails db:reset 時にエラーが出た時の解決方法

Posted at

内容

同じcsvファイルを複数回インポートしてしまい
rails db:resetを実行後ターミナル上でエラーが出される

エラー内容

PG::ObjectInUse: ERROR: database "アプリ名_development" is being accessed by other users DETAIL: There is 1 other session using the database.

解決策

エラー文を読み解いて意味が分かれば簡単ですね

DETAIL: There is 1 other session using the database.

要約すると

データベースを利用したユーザーが現在いる
という意味になります。

ということなんで、
サーバーを一旦切ります!

control + c

そして再度行います。

rails db:reset


Dropped database 'アプリ名_development'
Dropped database 'アプリ名_test'
Created database 'アプリ名_development'
Created database 'アプリ名_test'

出来ましたね!

エラー文を検索して調べる以外にも、

google翻訳で一度英文調べるのも解決策の一つになりますね。

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?