@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
# 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.
`root@whonix:/var/discourse# ./launcher enter app`
可能です。
root@whonix-app:/var/www/discourse#
tail shared/standalone/log/rails/production.log
Message Bus で予期しないエラーが発生しました: PG::UndefinedTable: エラー: リレーション "user_auth_tokens" が存在しません
LINE 1: SELECT "user_auth_tokens".* FROM "user_auth_tokens" WHERE ((...
^
ジョブ例外: PG::UndefinedTable: エラー: リレーション "application_requests" が存在しません
LINE 1: SELECT "application_requests"."id" FROM "application_request...
ERROR: could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
完全なログ:
root@whonix-app:/var/www/discourse# discourse restore whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
Starting restore: whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2020-05-25-132224 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
Extracting dump file...
Validating metadata...
Current version: 20200524181959
Restored version: 20200506044956
Enabling readonly mode...
Pausing sidekiq...
Waiting up to 60 seconds for Sidekiq to finish running jobs...
Creating missing functions in the discourse_functions schema...
Restoring dump file... (this may take a while)
[cut]
ALTER TABLE
[cut lots of duplicate ALTER TABLE lines]
ALTER TABLE
CREATE INDEX
[cut lots of duplicate CREATE INDEX lines]
CREATE INDEX
ERROR: could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL: Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
/var/www/discourse/lib/backup_restore/database_restorer.rb:95:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:49:in `run'
script/discourse:143:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
script/discourse:284:in `<top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2020-05-25-132224' directory...
Unpausing sidekiq...
Disabling readonly mode...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.
root@whonix-app:/var/www/discourse#