Database migrate fails in "stable" version

Sorry to bother again with that plugin (already did here : Keep Rails 6 compatibility for "stable" version)

My last upgrade fails for that plugin.
I have a “stable” Discourse version.
Latest version of the plugin is pulled and I get this stack below.

I suppose it comes from one of these commits :

I, [2022-11-02T10:32:23.244232 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
ArgumentError: wrong number of arguments (given 2, expected 1)
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/enum.rb:158:in `enum'
/var/www/discourse/plugins/discourse-gamification/app/models/gamification_leaderboard.rb:9:in `<class:GamificationLeaderboard>'
/var/www/discourse/plugins/discourse-gamification/app/models/gamification_leaderboard.rb:3:in `<main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:88:in `register'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `require_relative'
/var/www/discourse/plugins/discourse-gamification/plugin.rb:39:in `block in activate!'
/var/www/discourse/lib/plugin/instance.rb:478:in `block in notify_after_initialize'
/var/www/discourse/lib/plugin/instance.rb:476:in `each'
/var/www/discourse/lib/plugin/instance.rb:476:in `notify_after_initialize'
/var/www/discourse/config/application.rb:364:in `each'
/var/www/discourse/config/application.rb:364:in `block (2 levels) in <class:Application>'
/var/www/discourse/lib/plugin_initialization_guard.rb:5:in `plugin_initialization_guard'
/var/www/discourse/config/application.rb:363:in `block in <class:Application>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb:68:in `block in execute_hook'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application/finisher.rb:140:in `block in <module:Finisher>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:32:in `instance_exec'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:32:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:60:in `run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application.rb:391:in `initialize!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
/var/www/discourse/config/environment.rb:7:in `<main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:88:in `register'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `block in require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application.rb:367:in `require_environment!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)
I, [2022-11-02T10:32:28.725881 #1]  INFO -- : gem install rrule -v 0.4.4 -i /var/www/discourse/plugins/discourse-calendar/gems/2.7.6 --no-document --ignore-dependencies --no-user-install
Successfully installed rrule-0.4.4
1 gem installed



FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1950 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
5fcf6c7062e049c165c20aea48211ddccb2a45e99ae572e91c5078dc0700b4d9

I will pin the commit id to pull for this plugin but I prefer to notify about it.

Problem comes from this commit

Pinning to immediate previous commit did the trick.
In case anyone wants the workaround, define your plugin like this in hooks section of your discourse configuration yaml :

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/discourse-gamification && cd discourse-gamification && git checkout 6a399b4c220f31de62049504d27ff6e50611fbef
2 Likes

Any chance this will be fixed so we can use the latest?

Nope. You’ll have to wait for Discourse 3.0 stable in January (or switch your forum to beta or tests-passed for the time being)

Well… Happy New Year! :grin:

This is now fixed in stable :grimacing:

3 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.