이전에 커스텀 스크립트를 사용하여 포럼을 Discourse로 성공적으로 마이그레이션한 적이 있지만, 이제 다시 실행하면 다음과 같은 import 오류가 발생합니다:
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:81:in `rescue in new_client': We could not find your database: discourse. Which can be found in the database configuration file located at config/database.yml. (ActiveRecord::NoDatabaseError)
To resolve this issue:
- Did you create the database for this app, or delete it? You may need to create your database.
- Has the database name changed? Check your database.yml config has the correct database name.
To create your database, run:
bin/rails db:create
제 스크립트에서 다음 import가 실패합니다:
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
스크립트는 다음과 같이 실행하고 있습니다.
./launcher enter app
cd /var/www/discourse
bundle exec ruby script/import_scripts/avatar.rb
하지만 정확히 무엇이 문제인지 이해가 되지 않습니다: sudo -u postgres psql discourse를 통해 데이터베이스에 접근할 수 있으므로 “discourse” 데이터베이스가 존재하는 것은 확인했습니다. 또한 웹사이트도 정상적으로 작동하고 있습니다. rails c를 열어도 데이터에 접근할 수 있습니다.
여기서 무엇이 잘못되었는지 몇 가지 힌트를 주실 수 있을까요?