How to "migrate" Discourse to Discourse without Site Settings

We need to migrate all our database to a new bigger server (digital ocean).
We need to import only the database (users, passwords, posts, topics etc…) but we don’t want import the site settings, so we can’t use the normal way (backup restore).

That’s because in our installation the old admin delete some categories (like staff and lounge) and probably other things. Originally it was a trial installation to test Discourse so many settings have been touched or changed or even deleted and, I don’t know why, he has decided to make the forum public without a fresh installation.

Is it possible to do that in a easy way (if so, possibly step-by-step) to have a new fresh installation without lost all our data?

I do not think there is any way to import everything except the site settings.

Might it be possible to truncate the site_settings table prior to doing an import?

Of course that would still leave the mess caused by deleting and renaming categories, but it should help a bit.


Curious if there exist something like wp.

Export content, install new, import.

Can you explain how to do that?
We can try it in our (local) test site, just installed to make some experimentations.

With bulk selection this isn’t a big problem for us (of course we lost some days to do that)

Save a backup of course.

Once you open the database CLI run the query

TRUNCATE site_settings

AFAIK there are no FKs involved, but maybe the optional CASCADE wouldn’t hurt.


So I need to:

  1. unzip a backup
  2. open the folder with postgres
  3. truncate the site_settings
    (somenthing like
    psql -U username -d mydatabase -c TRUNCATE site_settings
    psql -U username -d mydatabase -c 'TRUNCATE' site_settings)
  4. zip again the backup
  5. restore the backup and pray

Is all correct @Mittineague?


Now we have a new test installation without site settings (except “notification mail”)
We still have our data, plugins, groups and categories, and our personal customization (css, html and js).

But I have the same trouble, staff and lounge categories were not created.

The only category that was created is Uncategorized (now I have 2 categories Uncategorized).

Any idea?

Sorry, but where I can find the staff_category_id ? I tried on /site.json (here on Meta too) and I can see the id for all the settings except for stuff category.
Is it a hidden id?
Where I can find it?


It’s a “hidden” site setting - you can only set it from the Rails console, I think?


Yeah I would not recommend nuking the whole site setting table here, but it is possible our site setting import/export rake task could be coerced to do this.

We basically want to work through all non hidden settings and revert them to default, some settings are hidden though and you don’t want to touch them.