mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
provision: Don't regenerate dev database unnecessarily.
This reuses the work we did some time ago to avoid regenerating the test database unnecessarily. In addition to being a nice convenience for developers (since any accomulated test data is still available), this also saves about half the time consumed in a no-op provision. Fixes #5182.
This commit is contained in:
@@ -240,18 +240,28 @@ def main(options):
|
||||
if not options.is_production_travis:
|
||||
# These won't be used anyway
|
||||
run(["scripts/setup/configure-rabbitmq"])
|
||||
run(["tools/setup/postgres-init-dev-db"])
|
||||
run(["tools/do-destroy-rebuild-database"])
|
||||
# Need to set up Django before using is_template_database_current.
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
|
||||
import django
|
||||
django.setup()
|
||||
from zerver.lib.test_fixtures import is_template_database_current
|
||||
|
||||
if options.is_force or not is_template_database_current(
|
||||
migration_status="var/migration_status_dev",
|
||||
settings="zproject.settings",
|
||||
database_name="zulip",
|
||||
):
|
||||
run(["tools/setup/postgres-init-dev-db"])
|
||||
run(["tools/do-destroy-rebuild-database"])
|
||||
else:
|
||||
print("No need to regenerate the dev DB.")
|
||||
|
||||
if options.is_force or not is_template_database_current():
|
||||
run(["tools/setup/postgres-init-test-db"])
|
||||
run(["tools/do-destroy-rebuild-test-database"])
|
||||
else:
|
||||
print("No need to regenerate the test DB.")
|
||||
|
||||
run(["./manage.py", "compilemessages"])
|
||||
|
||||
# Here we install nvm, node, and npm.
|
||||
|
||||
Reference in New Issue
Block a user