DEV: Respect SKIP_TEST_DATABASE when running rake db:create (#24407)

Why this change?

By default the `db:create` Rake task in activerecord creates the
databases for both the development and test environment. This while
seemingly odd is by design from Rails. In order to avoid creating the
test database, Rails supports the `SKIP_TEST_DATABASE` environment
variable which we should respect when creating the multisite test
database.
This commit is contained in:
Alan Guo Xiang Tan
2023-11-16 20:01:12 +08:00
committed by GitHub
parent 575c2c8573
commit 416cef9ed1

View File

@@ -20,7 +20,8 @@ module MultisiteTestHelpers
end
def self.create_multisite?
(ENV["RAILS_ENV"] == "test" || !ENV["RAILS_ENV"]) && !ENV["RAILS_DB"] && !ENV["SKIP_MULTISITE"]
(ENV["RAILS_ENV"] == "test" || !ENV["RAILS_ENV"]) && !ENV["RAILS_DB"] &&
!ENV["SKIP_MULTISITE"] && !ENV["SKIP_TEST_DATABASE"]
end
end