Failed upgrade from 2.3.2 to 2.3.6 due to discourse assign plugin

When I try to upgrade from 2.3.2 to 2.3.6 I see this error:

I, [2019-12-02T07:43:47.773465 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
ArgumentError: Unknown migration version "6.0"; expected one of "4.2", "5.0", "5.1", "5.2"
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration/compatibility.rb:11:in `find'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:536:in `[]'
/var/www/discourse/plugins/discourse-assign/db/migrate/20191119174425_rename_site_setting_assign_emailer.rb:3:in `<top (required)>'
.......................................

If I disable discourse-assign plugin - all works fine…
But! One month later I upgrated another discourse forum from 2.3.2 to 2.3.6 - all passed good…
What I doing wrong?
I try:

cd /var/discourse
git pull
./launcher rebuild app

As you have diagnosed, the problem is with the discord assign plugin. (do you mean discord assign?)

of course! sorry ))) will edit…

Here is the guilty one:
20191119174425_rename_site_setting_assign_emailer.rb

Contains:

# frozen_string_literal: true

class RenameSiteSettingAssignEmailer < ActiveRecord::Migration[6.0]
  def up
    execute "UPDATE site_settings
             SET name = 'assign_mailer', value = '#{AssignMailer.levels[:always]}', data_type = #{SiteSettings::TypeSup
ervisor.types[:enum]}
             WHERE name = 'assign_mailer_enabled' AND value = 't' AND data_type = #{SiteSettings::TypeSupervisor.types[
:enum]}"

    execute "UPDATE site_settings
             SET name = 'assign_mailer', value = '#{AssignMailer.levels[:never]}', data_type = #{SiteSettings::TypeSupe
rvisor.types[:enum]}
             WHERE name = 'assign_mailer_enabled' AND value = 'f' AND data_type = #{SiteSettings::TypeSupervisor.types[
:enum]}"
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
end

How can i fix this? If I fix it directly in this file, will the repository be downloaded again when the rebuild starts and my changes will be erased?

Solution:

  1. comment discourse-assing plugin in app.yml
  2. rebuild app with ./launcher rebuild app
  3. go to inside container ./launcher enter app
  4. cd /var/www/discourse/plugins
  5. git clone https://github.com/discourse/discourse-assign.git
  6. go to cd /var/www/discourse/plugins/discourse-assign/db/migrate
  7. edit file 20191119174425_rename_site_setting_assign_emailer.rb, replace ActiveRecord::Migration[6.0] to ActiveRecord::Migration[5.2]
  8. save file and exit from editor
  9. go to cd /var/www/discourse
  10. run su discourse -c 'bundle exec rake db:migrate'
  11. exit from container
  12. uncomment discourse-assign plugin in app.yml
  13. rebuild app AGAIN with ./launcher rebuild app
  14. TA-DA-DA-TAM! All works!

I have no decent words to describe this process! )))))))))

2 Likes

Thanks for reporting the issue @nahimov, it should now be fixed without needing the workaround you described

cc @udan11

6 Likes

This topic was automatically closed after 3 hours. New replies are no longer allowed.