Migrate a Vanilla forum to Discourse

/var/www/discourse# RAILS_ENV=production ruby script/import_scripts/vanilla.rb /shared/export.txt
/var/www/discourse/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4.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.

I got passed the Gemfile. but now i am getting this error. any suggestions

Got based that error… by adding a password and having to set up the database.yml file… and now onto the next error Loading existing groups…
Loading existing users…
Loading existing categories…
Loading existing posts…
Loading existing topics…
parsing file…
reading file…
script/import_scripts/vanilla.rb:88:in gsub': invalid byte sequence in UTF-8 (ArgumentError) from script/import_scripts/vanilla.rb:88:in read_file’
from script/import_scripts/vanilla.rb:47:in parse_file' from script/import_scripts/vanilla.rb:25:in execute’
from /var/www/discourse/script/import_scripts/base.rb:47:in perform' from script/import_scripts/vanilla.rb:295:in

Suggests that your database (or part of it) isn’t in UTF-8.

You can google about how to get your database in to UTF-8. Maybe it’s in some other encoding and you can transfer it over, or maybe parts of it have bad characters in it.

EDIT: it’s reading the “vanilla csv” file (whatever that is), and it’s not UTF-8 encoded, which is much easier to fix than the database. I still don’t quite know what to tell you, but there are some funky characters in there that aren’t recognized as UTF-8, and you’ll need to figure out how to fix that.

now i am getting this…

importing categories…
script/import_scripts/vanilla.rb:140:in import_categories': private method select’ called for nil:NilClass (NoMethodError)

@root_category = @categories.select { |c| c[:category_id] == "-1" }.first
                            ^^^^^^^
    from script/import_scripts/vanilla.rb:28:in `execute'
    from /var/www/discourse/script/import_scripts/base.rb:47:in `perform'
    from script/import_scripts/vanilla.rb:295:in `<main>'

root@vultr-app:/var/www/discourse# cd script/import_scripts
root@vultr-app:/var/www/discourse/script/import_scripts# sudo nano vanilla.rb
root@vultr-app:/var/www/discourse/script/import_scripts# cd …
root@vultr-app:/var/www/discourse/script# cd …
root@vultr-app:/var/www/discourse# RAILS_ENV=production ruby script/import_scripts/vanilla.rb public/uploads/vanilla.txt
Loading existing groups…
Loading existing users…
Loading existing categories…
Loading existing posts…
Loading existing topics…
parsing file…
reading file…

importing topics…
/var/www/discourse/script/import_scripts/base.rb:544:in create_posts': undefined method count’ for nil:NilClass (NoMethodError)

total = opts[:total] || results.count
                               ^^^^^^
    from script/import_scripts/vanilla.rb:184:in `import_topics'
    from script/import_scripts/vanilla.rb:30:in `execute'
    from /var/www/discourse/script/import_scripts/base.rb:47:in `perform'
    from script/import_scripts/vanilla.rb:295:in `<main>'

root@vultr-app:/var/www/discourse# RAILS_ENV=production ruby script/import_scripts/vanilla.rb public/uploads/export.txt
Loading existing groups…
Loading existing users…
Loading existing categories…
Loading existing posts…
Loading existing topics…
parsing file…
reading file…
script/import_scripts/vanilla.rb:88:in gsub': invalid byte sequence in UTF-8 (ArgumentError) from script/import_scripts/vanilla.rb:88:in read_file’
from script/import_scripts/vanilla.rb:47:in parse_file' from script/import_scripts/vanilla.rb:25:in execute’
from /var/www/discourse/script/import_scripts/base.rb:47:in perform' from script/import_scripts/vanilla.rb:295:in
root@vultr-app:/var/www/discourse#

That’s the same error that I talked about in my last reply.