FIX: Seed needs to run before optimizing site icons.

FIX: Seed needs to run before optimizing site icons.

diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index e6096e8..e8d3c42 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -158,12 +158,15 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do |
   execute_concurently(concurrency, exceptions) do |db|
-    if !Discourse.skip_post_deployment_migrations? && ENV['SKIP_OPTIMIZE_ICONS'] != '1'
-      SiteIconManager.ensure_optimized!
+    if !Discourse.skip_post_deployment_migrations?
       if ENV['SKIP_SEED'] != '1'
         puts "Seeding #{db}"
+      if ENV['SKIP_OPTIMIZE_ICONS'] != '1'
+        SiteIconManager.ensure_optimized!
+      end

GitHub sha: 715ddf38

Followed up to DEV: Add skip seed flag (PR #10116)

@blake Note that we need to seed the database first before running SiteIconManager.ensure_optmized. It looks like the order was changed after the PR was reviewed. I see a commit saying we need the SKIP_SEED flag but I’m unsure why that is needed. If we do need the flag, do we need to add the flag to db:migrate as well? The change here only affects multisite:migrate

1 Like

Thanks for the fix!

Yes, we still need the SKIP_SEED flag because !skip_post_deployment_migrations? is true if we omit the SKIP_POST_DEPLOYMENT_MIGRATIONS flag or if it is set to 0. We have it set to 0 in our post deployment script but we don’t want to run the seed data during post deployment, we just want it to run the post deployment migrations.

I don’t think we need the SKIP_SEED flag in our db:migrate section yet because it is only needed when doing post deployment. We can always add it, but I’d prefer to wait until we know we will use it.