db tools: Rename do-destroy-*database.

The new tools now have more concise, more parallel names:

    - rebuild-dev-database
    - rebuild-test-database

The actual implementations are still pretty different:

rebuild-dev-database:
    mostly delegates to 5 management scripts

rebuild-test-database:
    is a very thin wrapper for generate-fixtures

We'll try to clean that up a bit soon.
This commit is contained in:
Steve Howell
2020-04-21 20:03:12 +00:00
committed by Tim Abbott
parent 67d0349239
commit 54151bb548
7 changed files with 15 additions and 12 deletions

23
tools/rebuild-dev-database Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
set -x
"$(dirname "$0")/../scripts/setup/terminate-psql-sessions" zulip zulip zulip_base
psql -v ON_ERROR_STOP=1 -e -h localhost postgres zulip <<EOF
DROP DATABASE IF EXISTS zulip;
CREATE DATABASE zulip TEMPLATE zulip_base;
EOF
"$(dirname "$0")/../scripts/setup/flush-memcached"
./manage.py purge_queue --all
./manage.py migrate --noinput
./manage.py get_migration_status --settings=zproject.settings --output="migration_status_dev"
./manage.py createcachetable third_party_api_results
./manage.py populate_db -n100 --threads=1
# Ensure that the local user's API key is synced from ~/.zuliprc
if [ -e ~/.zuliprc ]; then
./manage.py sync_api_key
fi