You’ve got yourself a Discourse backup file and want to load it into your development database, without using the web UI, or potentially with a different database name. Cool!
This will assume you already have a Postgres database server running.
Restoring the backup manually is easy:
$ tar zxvf backup-file.tar.gz
# you now have dump.sql.gz, meta.json, and possibly an uploads/ directory
$ gunzip dump.sql.gz
$ DATABASE=discourse_development
$ dropdb --if-exists $DATABASE && createdb $DATABASE
$ psql $DATABASE < dump.sql
$ bundle exec rake db:migrate
Since the database dump targets the public schema directly, the simplest approach for development is to drop and recreate the database before importing.
Last edited by @zogstrip 2025-02-25T13:42:29Z
Check document
Perform check on document: