Restore problem: relation "theme_fields" does not exist

(Jay Pfaffman) #1

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

I get

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

(Sam Saffron) #2

Going to have to ship this into the #support category, there could be some sort of bug here, but we need a proper repro that works consistently.

Can you consistently make this fail?