Migration Version Error when Updating Discourse

AI-generated summary

The discussion revolves around a Migration Version Error when updating Discourse. hyphalos reported encountering this error while trying to update, and RGJ suspected it was due to yesterday’s security patch not being compatible with stable, possibly related to a [6.0] migration.

@blake investigated and found the issue was with the discourse-calendar plugin. After identifying the problem, a fix was created, and blake informed hyphalos that they could proceed with updating Discourse. hyphalos thanked blake for their prompt response and help.

Hey

I’m trying to update Discourse and I keep running into this error:

discourse-user-card-badges is already at latest compatible version
docker_manager is already at latest compatible version
discourse-extra-group-classes is already at latest compatible version
discourse-docs is already at latest compatible version
discourse-rss-polling is already at latest compatible version
discourse-cakeday is already at latest compatible version
discourse-translator is already at latest compatible version
discourse-invite-tokens is already at latest compatible version
checking out compatible discourse-assign version: 46f200935dc9e5750c3f2740abd993e27a9b3f6c
HEAD is now at 46f2009 Update translations (#331)
discourse-landing-pages is already at latest compatible version
discourse-saml is already at latest compatible version
discourse-custom-wizard is already at latest compatible version
discourse-sitemap is already at latest compatible version
discourse-legal-tools is already at latest compatible version
checking out compatible discourse-spoiler-alert version: c65972911f7ab3323dfe3de4a727a9cb2961b57b
HEAD is now at c659729 DEV: Update CI workflows (#83)
discourse-solved is already at latest compatible version
discourse-checklist is already at latest compatible version
discourse-canned-replies is already at latest compatible version

I, [2022-06-15T01:32:12.316411 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
ArgumentError: Unknown migration version "7.0"; expected one of "4.2", "5.0", "5.1", "5.2", "6.0", "6.1"
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration/compatibility.rb:11:in `find'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:567:in `[]'
/var/www/discourse/plugins/discourse-calendar/db/post_migrate/20220613073844_unescape_event_name.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.5.3/lib/zeitwerk/kernel.rb:35:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1045:in `load_migration'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1041:in `migration'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1037:in `disable_ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1387:in `use_transaction?'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1334:in `rescue in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1322:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `migrate'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1086:in `up'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1061:in `migrate'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/var/www/discourse/lib/tasks/db.rake:218:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:33:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:14:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:210:in `block in <main>'
/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>'

What can I do to fix this?

EDIT: to clarify, I’m running this on stable

Cheers

It looks like yesterdays security patch is not compatible with stable @blake , it looks like it could be a [6.0] migration as well.

@hyphalos Trying to trace which migration we might need to update here. Do you by chance have the discourse-calendar plugin installed?

EDIT:

Ah looks like it. Missed this in the logs above on first glance:

/var/www/discourse/plugins/discourse-calendar/db/post_migrate/20220613073844_unescape_event_name.rb:3:in

@hyphalos A fix has been created for the discourse-calendar plugin. You can go ahead and update discourse now.

Thank you @blake ! Appreciate your response and help!