DEV: db:migrate no longer works after db:schema:load

DEV: db:migrate no longer works after db:schema:load

In Rails 6 due to internal changes, the following sequence no longer works:

RAILS_ENV=test bin/rake db:migrate
RAILS_ENV=test bin/rake db:schema:dump
dropdb discourse_test
createdb discourse_test
RAILS_ENV=test bin/rake db:schema:load
RAILS_ENV=test bin/rake db:migrate

What appears to be happening is that our tracking of plugin migrations is being missed on schema:dump or load.

A more comprehensive fix restoring schema:dump / load support will be investigated.

diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index 03bbcee..0375d96 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -68,8 +68,6 @@ task 'db:migrate' => ['environment', 'set_locale'] do |_, args|
   end
 
   if MultisiteTestHelpers.load_multisite?
-    system("rake db:schema:dump")
-    system("RAILS_DB=discourse_test_multisite rake db:schema:load")
     system("RAILS_DB=discourse_test_multisite rake db:migrate")
   end
 end

GitHub sha: 1ca257be

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: