# Database migratie mislukt in "stable" versie

**URL:** https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979
**Category:** Self-hosting
**Tags:** gamification
**Created:** [2 november 2022 om 12:13 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979 "2022-11-02T12:13:55Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![gmoirod](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gmoirod/32/263768_2.png) [@gmoirod](https://meta.discourse.org/u/gmoirod)
#### Post date: [2 november 2022 om 12:13 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979/1 "2022-11-02T12:13:55Z")

</div>

Sorry to bother again with that plugin (already did here : [Keep Rails 6 compatibility for "stable" version](https://meta.discourse.org/t/keep-rails-6-compatibility-for-stable-version/231378))

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 :  
[https://github.com/discourse/discourse-gamification/commit/ab90d4ce415f8ea08e9bc1cca84a26474b67a3af](https://github.com/discourse/discourse-gamification/commit/ab90d4ce415f8ea08e9bc1cca84a26474b67a3af)  
[https://github.com/discourse/discourse-gamification/commit/d6c5db58f7bb3d683d55602d0cc84e10d2ab214a](https://github.com/discourse/discourse-gamification/commit/d6c5db58f7bb3d683d55602d0cc84e10d2ab214a)

```plaintext
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.

---

<div class="post-metadata">

### Author: ![gmoirod](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gmoirod/32/263768_2.png) [@gmoirod](https://meta.discourse.org/u/gmoirod)
#### Post date: [2 november 2022 om 12:40 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979/2 "2022-11-02T12:40:20Z")

</div>

Problem comes from this commit  
[https://github.com/discourse/discourse-gamification/commit/d6c5db58f7bb3d683d55602d0cc84e10d2ab214a](https://github.com/discourse/discourse-gamification/commit/d6c5db58f7bb3d683d55602d0cc84e10d2ab214a)

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 :

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

```

---

<div class="post-metadata">

### Author: ![Scott\_Hurrey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scott_hurrey/32/286764_2.png) [@Scott\_Hurrey](https://meta.discourse.org/u/Scott_Hurrey)
#### Post date: [22 december 2022 om 20:52 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979/3 "2022-12-22T20:52:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [22 december 2022 om 20:55 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979/4 "2022-12-22T20:55:36Z")

</div>

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)

> [@Keep Rails 6 compatibility for "stable" version](https://meta.discourse.org/t/keep-rails-6-compatibility-for-stable-version/231378/3):
>
> `discourse-gamification` is a very new plugin, we do not expect to support it on the stable version of discourse. The first officially supported stable version will be on the next release of Discourse

---

<div class="post-metadata">

### Author: ![gmoirod](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gmoirod/32/263768_2.png) [@gmoirod](https://meta.discourse.org/u/gmoirod)
#### Post date: [22 december 2022 om 22:17 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979/5 "2022-12-22T22:17:26Z")

</div>

> [@RGJ](#):
>
> You’ll have to wait for Discourse 3.0 stable in January

Well… Happy New Year! 😁

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [11 januari 2023 om 13:55 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979/6 "2023-01-11T13:55:26Z")

</div>

This is now fixed in stable 😬

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [14 januari 2023 om 11:00 UTC](https://meta.discourse.org/t/database-migrate-fails-in-stable-version/243979/7 "2023-01-14T11:00:42Z")

</div>

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