Files
zulip/tools/do-destroy-rebuild-database
Tim Abbott cecf7f1740 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.
2017-06-02 13:27:34 -07:00

27 lines
687 B
Bash
Executable File

#!/usr/bin/env bash
set -e
set -x
"$(dirname "$0")/../scripts/setup/terminate-psql-sessions" zulip zulip zulip_base
function migration_status {
./manage.py get_migration_status --settings=zproject.settings > $1
}
psql -h localhost postgres zulip <<EOF
DROP DATABASE IF EXISTS zulip;
CREATE DATABASE zulip TEMPLATE zulip_base;
EOF
sh "$(dirname "$0")/../scripts/setup/flush-memcached"
./manage.py migrate --noinput
migration_status "var/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