Discourse docker rebuild failed with Unknown Migration Version

AI-generated summary

A user, dhsathiya, encountered an “Unknown Migration Version” error while rebuilding their Discourse Docker with ./launcher rebuild myapp. The error occurred due to a migration issue with the akismet plugin.

dhsathiya is using the stable release of Discourse (v2.3.6). Stephen suggested that the issue was fixed 10 days prior and recommended running git pull and ./launcher rebuild app to resolve the issue.

However, dhsathiya reported that this solution did not work. gerhard, who fixed the migration in the akismet plugin, advised rebuilding the app to try the fix.

I was rebuilding with ./launcher rebuild myapp and got following error :

I, [2019-11-22T04:39:11.739534 #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-akismet/db/migrate/20191031193436_remove_old_akismet_states.rb:3:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:986:in `load_migration'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:982:in `migration'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:977:in `disable_ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1350:in `use_transaction?'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1297:in `rescue in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1285:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1262:in `each'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1210:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1210:in `migrate'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1036:in `up'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:1011:in `migrate'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/var/www/discourse/lib/migration/safe_migrate.rb:52:in `migrate'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

current base : discourse/base 2.0.20191013-2320

Let me know if any other information is needed.
Thanks !

Which release are you on? Stable, Beta or tests-passed?

stable

When go to discourse web it shows me : discourse v2.3.6

Looks like @gerhard fixed this 10 days ago, there were some 6.0 migrations which caused issues with stable.

Run a:

git pull
./launcher rebuild app

Or if you renamed your app.yml as myapp.yml ./launcher rebuild myapp

Then try again- report back if it doesn’t work.

Yes I did it couple of times.
It is not working

I fixed the migration in the akismet plugin. Please give it a try by rebuilding your app.

https://github.com/discourse/discourse-akismet/commit/d2503ae65f79e250940590ffb1536d8ec5ef38e5