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, and you’ve already run the createdb
command if appropriate.
Restoring the backup manually is easy, you just need a couple extra SQL statements on the end to switch the schema over.
$ tar zxvf backup-file.tar.gz
# you now have the dump.sql and meta.json files
$ DATABASE=discourse_development
$ psql $DATABASE < dump.sql
$ psql $DATABASE <<END
DROP SCHEMA IF EXISTS backup CASCADE;
ALTER SCHEMA public RENAME TO backup;
ALTER SCHEMA restore RENAME TO public;
END
$ bundle exec rake db:migrate
Last edited by @zogstrip 2025-02-25T13:42:29Z
Check document
Perform check on document: