I have successfully migrated a forum to Disourcse with a custom script before, but now when I execute it again, I get the following import error:
/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
./launcher enter app
cd /var/www/discourse
bundle exec ruby script/import_scripts/avatar.rb
I don’t really understand the error though: I can access the database through sudo -u postgres psql discourse, validating that the database “discourse” does exist. Also, the website is running fine. When I open rails c I can also access the data.
Can you give me some pointers what’s messed up there?
Discourse can’t find its database. So you need to fix that. Was this a standard install or a development install? Have a look at the appropriate guide and make discourse work as the first step.
I did reboot and it didn’t fix the issue. I now also encounter the same issue on my local machine (local docker)… which makes me think that somehow I run the command somehow incorrectly…
And thank you – I celebrate the swiftness of your responses and the support!