Right now I am running v2.1.5 and trying to upgrade it to v2.2.5. And here’s an example of what I have to do for backup import to work:
<...>
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ERROR: function discourse_functions.raise_email_logs_reply_key_readonly() does not exist
ERROR: current transaction is aborted, commands ignored until end of transaction block
ERROR: current transaction is aborted, commands ignored until end of transaction block
ERROR: current transaction is aborted, commands ignored until end of transaction block
EXCEPTION: psql failed
/var/www/discourse/lib/backup_restore/restorer.rb:320:in `restore_dump'
/var/www/discourse/lib/backup_restore/restorer.rb:66:in `run'
script/discourse:136:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
script/discourse:277:in `<top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:463:in `exec'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:18:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22: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...
Removing tmp '/var/www/discourse/tmp/restores/default/2019-05-14-121130' directory...
Unpausing sidekiq...
Disabling readonly mode...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.
root@forum1-app:/var/www/discourse# su - discourse
discourse@forum1-app:~$ cd /var/www/discourse/
discourse@forum1-app:/var/www/discourse$ RAILS_ENV=production bundle exec rails c
Loading production environment (Rails 5.2.2.1)
irb(main):001:0> require_dependency 'migration/base_dropper'
=> true
irb(main):002:0> Migration::BaseDropper.send(:create_readonly_function, ['email_logs', 'reply_key'])
=> 0
irb(main):003:0> Migration::BaseDropper.send(:create_readonly_function, ['email_logs', 'skipped_reason'])
=> 0
irb(main):004:0> Migration::BaseDropper.send(:create_readonly_function, 'topic_status_updates')
=> 0
irb(main):005:0> Migration::BaseDropper.send(:create_readonly_function, 'users_email')
=> 0
irb(main):006:0>
discourse@forum1-app:/var/www/discourse$ logout
root@forum1-app:/var/www/discourse# discourse restore forum-2019-05-09-033432-v20180828065005.tar.gz
Starting restore: forum-2019-05-09-033432-v20180828065005.tar.gz
[STARTED]