# How to "migrate" Discourse to Discourse without Site Settings

**URL:** https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741
**Category:** Support
**Created:** [5 september 2016 om 13:51 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741 "2016-09-05T13:51:25Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [5 september 2016 om 13:51 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/1 "2016-09-05T13:51:25Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5 september 2016 om 20:34 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/2 "2016-09-05T20:34:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [5 september 2016 om 20:41 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/3 "2016-09-05T20:41:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@charles](https://meta.discourse.org/u/charles)
#### Post date: [5 september 2016 om 21:59 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/4 "2016-09-05T21:59:31Z")

</div>

Curious if there exist something like wp.

Export content, install new, import.

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [6 september 2016 om 04:55 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/5 "2016-09-06T04:55:18Z")

</div>

> [@Mittineague](#):
>
> Might it be possible to truncate the site\_settings table prior to doing an import?

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

> [@Mittineague](#):
>
> Of course that would still leave the mess caused by deleting and renaming categories, but it should help a bit.

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

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [6 september 2016 om 05:01 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/6 "2016-09-06T05:01:57Z")

</div>

> [@Trash](#):
>
> Can you explain how to do that?

Save a backup of course.

Once you open the database CLI run the query

```plaintext
TRUNCATE site_settings

```

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

> **[TRUNCATE](https://www.postgresql.org/docs/9.1/sql-truncate.html)**
>
> TRUNCATE TRUNCATE — empty a table or set of tables Synopsis TRUNCATE \[TABLE \] \[ONLY \] name \[ …

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [8 september 2016 om 09:17 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/7 "2016-09-08T09:17:47Z")

</div>

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`  
or  
`psql -U username -d mydatabase -c 'TRUNCATE' site_settings`)
4. zip again the backup
5. restore the backup and pray

Is all correct @Mittineague?

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [9 september 2016 om 10:24 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/8 "2016-09-09T10:24:33Z")

</div>

Done.

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).

 ![](https://global.discourse-cdn.com/meta/original/4X/5/9/0/5905a41a4fe6dfcfb5e86fe857b4fd1776f286db.png)  
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?

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [9 september 2016 om 13:46 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/9 "2016-09-09T13:46:00Z")

</div>

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?

Thanks

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [10 september 2016 om 22:05 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/10 "2016-09-10T22:05:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [4 maart 2019 om 20:39 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/11 "2019-03-04T20:39:15Z")

</div>



---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [4 maart 2019 om 22:42 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/12 "2019-03-04T22:42:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [12 april 2022 om 12:52 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-to-discourse-without-site-settings/49741/13 "2022-04-12T12:52:28Z")

</div>


