DEV: improve on rake db:create

pending
#1

DEV: improve on rake db:create

Followup on 3af00a65 which broke build

diff --git a/config/initializers/100-logster.rb b/config/initializers/100-logster.rb
index 3fd4778..06e6ba6 100644
--- a/config/initializers/100-logster.rb
+++ b/config/initializers/100-logster.rb
@@ -1,7 +1,9 @@
 # frozen_string_literal: true
 
 if GlobalSetting.skip_redis?
-  Rails.logger = Rails.logger.chained.first
+  if Rails.logger.respond_to? :chained
+    Rails.logger = Rails.logger.chained.first
+  end
   return
 end
 
@@ -142,6 +144,8 @@ RailsMultisite::ConnectionManagement.each_connection do
 end
 
 if Rails.configuration.multisite
-  chained = Rails.logger.chained
-  chained && chained.first.formatter = RailsMultisite::Formatter.new
+  if Rails.logger.respond_to? :chained
+    chained = Rails.logger.chained
+    chained && chained.first.formatter = RailsMultisite::Formatter.new
+  end
 end
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index d55ecb6..d14354d 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -26,9 +26,9 @@ task 'db:force_skip_persist' do
   GlobalSetting.skip_redis = true
 end
 
-task 'db:create' do |_, args|
-  if MultisiteTestHelpers.load_multisite?
-    system("RAILS_DB=discourse_test_multisite rake db:create")
+task 'db:create' => [:load_config] do |_, args|
+  if !ENV['RAILS_ENV']
+    system("RAILS_ENV=test RAILS_DB=discourse_test_multisite rake db:create")
   end
 end

GitHub sha: a01488ae

1 Like
FIX: site settings loading default values when no db