# Restore problem: relation "theme\_fields" does not exist

**URL:** <https://meta.discourse.org/t/restore-problem-relation-theme-fields-does-not-exist/95500>\
**Category:** Self-hosting\
**Created:** [August 23, 2018, 6:32pm UTC](https://meta.discourse.org/t/restore-problem-relation-theme-fields-does-not-exist/95500 "2018-08-23T18:32:23Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [August 23, 2018, 6:32pm UTC](https://meta.discourse.org/t/restore-problem-relation-theme-fields-does-not-exist/95500/1 "2018-08-23T18:32:23Z")

</div>

@tgxworld, I think this is in your wheelhouse.  
Trying to restore a backup from `Discourse 2.1.0.beta5 - https://github.com/discourse/discourse version 8da2d8df3d5f7196f1c267b8a664597a725241ac` or `"Discourse 2.1.0.beta5 - https://github.com/discourse/discourse version bed34b52b51ab903bcb7854cc1efb2bf4107ddfb"` to `f4ae53d52b70a6577a60388f3550f168a4706b5f`

I get

```plaintext
# discourse restore mineral-rights-forum-2018-08-23-033241-v20180812150839.tar.gz
bundler: failed to load command: script/discourse (script/discourse)
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "theme_fields" does not exist
LINE 8: WHERE a.attrelid = '"theme_fields"'::regclass
                                          ^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                     c.collname, col_description(a.attrelid, a.attnum) AS comment
                FROM pg_attribute a
                LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                LEFT JOIN pg_type t ON a.atttypid = t.oid
                LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
               WHERE a.attrelid = '"theme_fields"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

```

I tried restoring a backup from Beta 4 and it fails the same way, so I think it’s a problem with the current Discourse restoring, not the way that backups are created.

EDIT: It looks like the first time that I restore it works, but if I restore again, it fails. I’ve not yet tested this on more than one database.

---

_[View the full topic](https://meta.discourse.org/t/restore-problem-relation-theme-fields-does-not-exist/95500)._
