فشل الترقية من 2.3.2 إلى 2.3.6 بسبب إضافة discourse assign

عند محاولة الترقية من الإصدار 2.3.2 إلى 2.3.6، أواجه الخطأ التالي:

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)>'
.......................................

إذا قمت بتعطيل إضافة discourse-assign، فكل شيء يعمل بشكل صحيح…
لكن! بعد شهر، قمت بترقية منتدى discourse آخر من 2.3.2 إلى 2.3.6، ومرت العملية بنجاح…
ما الخطأ الذي أقوم به؟
جربت ما يلي:

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! )))))))))

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

cc @dan