FIX: initializer should not crash if no database (PR #8154)

I think that this is a reasonable clean approach.

I checked also another approach, to not load plugins and middlewares when rake db:create is run. It can be achieved via adding to Rakefile

+ $rake_db_create = $*.include?('db:create')
require File.expand_path('../config/application', __FILE__)

and then use if !$rake_db_create - I checked that this would need to be added in 5-6 places. In addition, there may be a problem when rake commands are combined.

I checked if I can hook in tasks/db.rake instead of in Rakefile but that’s already too late

task 'db:create' => [:load_config] do |_, args|
  if MultisiteTestHelpers.create_multisite?
    system("RAILS_ENV=test RAILS_DB=discourse_test_multisite rake db:create")


You’ve signed the CLA, lis2. Thank you! This pull request is ready for review.