mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Improve multisite db scripts in dev (#17337)
## Without multisite.yml config No change. `bin/rails db:create` / `db:migrate` / `db:drop` should work the same. ## With multisite.yml config ### db:create `bin/rails db:create` creates development, test, and all databases from the multisite config `RAILS_DB=[site] bin/rails db:create` creates the database for the specified site from the multisite config ### db:migrate `bin/rails db:migrate` migrates the development database and all databases from the multisite config `RAILS_ENV=test bin/rails db:migrate` migrates the test database and `discourse_test_multisite` `RAILS_DB=[site] bin/rails db:migrate` migrates the database for the specified site from the multisite config ### db:drop `bin/rails db:drop` drops development, test, and all databases from the multisite config `RAILS_DB=[site] bin/rails db:create` drops the database for the specified site from the multisite config
This commit is contained in:
@ -45,7 +45,7 @@ if ENV['RAILS_ENV'] == "test" && ENV['TEST_ENV_NUMBER']
|
||||
pid = Process.spawn("redis-server --dir tmp/test_data_#{n}/redis --port #{port}", out: "/dev/null")
|
||||
|
||||
ENV["DISCOURSE_REDIS_PORT"] = port.to_s
|
||||
ENV["RAILS_DB"] = "discourse_test_#{n}"
|
||||
ENV["RAILS_TEST_DB"] = "discourse_test_#{n}"
|
||||
|
||||
at_exit do
|
||||
Process.kill("SIGTERM", pid)
|
||||
|
Reference in New Issue
Block a user