A user, nahimov, encountered an error when upgrading from Discourse 2.3.2 to 2.3.6 due to a compatibility issue with the Discourse Assign plugin. The issue was caused by a migration file (20191119174425_rename_site_setting_assign_emailer.rb) that referenced ActiveRecord::Migration[6.0], which was not compatible with the target Discourse version.
nahimov identified the problematic file and proposed a temporary fix by commenting out the plugin, rebuilding the app, editing the migration file to reference ActiveRecord::Migration[5.2], and then running the migration manually.
However, david later confirmed that the issue has been fixed in the Discourse Assign plugin repository, making the workaround unnecessary. The fix is available in the commit 60f7aa62bd3b3ad7a0936cbf3554bd0f78789019.
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:
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?