mirror of https://github.com/zulip/zulip.git
migration_status: Switch to passing the path in Python.
This is an important prerequisite to changing these paths used in provisioning.
This commit is contained in:
parent
a7c639cff7
commit
b7c3b4df0c
|
@ -4,10 +4,6 @@ set -x
|
||||||
|
|
||||||
"$(dirname "$0")/../scripts/setup/terminate-psql-sessions" zulip zulip zulip_base
|
"$(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
|
psql -h localhost postgres zulip <<EOF
|
||||||
DROP DATABASE IF EXISTS zulip;
|
DROP DATABASE IF EXISTS zulip;
|
||||||
CREATE DATABASE zulip TEMPLATE zulip_base;
|
CREATE DATABASE zulip TEMPLATE zulip_base;
|
||||||
|
@ -17,7 +13,7 @@ sh "$(dirname "$0")/../scripts/setup/flush-memcached"
|
||||||
|
|
||||||
./manage.py purge_queue --all
|
./manage.py purge_queue --all
|
||||||
./manage.py migrate --noinput
|
./manage.py migrate --noinput
|
||||||
migration_status "var/migration_status_dev"
|
./manage.py get_migration_status --settings=zproject.settings --output="var/migration_status_dev"
|
||||||
./manage.py createcachetable third_party_api_results
|
./manage.py createcachetable third_party_api_results
|
||||||
./manage.py populate_db -n100 --threads=1
|
./manage.py populate_db -n100 --threads=1
|
||||||
# Ensure that the local user's API key is synced from ~/.zuliprc
|
# Ensure that the local user's API key is synced from ~/.zuliprc
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
function migration_status {
|
|
||||||
./manage.py get_migration_status --settings=zproject.test_settings > $1
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$1" != "--force" ]; then
|
if [ "$1" != "--force" ]; then
|
||||||
"$(dirname "$0")/../../scripts/setup/terminate-psql-sessions" zulip zulip_test zulip_test_base zulip_test_template
|
"$(dirname "$0")/../../scripts/setup/terminate-psql-sessions" zulip zulip_test zulip_test_base zulip_test_template
|
||||||
psql -h localhost postgres zulip_test << EOF
|
psql -h localhost postgres zulip_test << EOF
|
||||||
|
@ -26,7 +22,8 @@ EOF
|
||||||
sh "$(dirname "$0")/../../scripts/setup/flush-memcached"
|
sh "$(dirname "$0")/../../scripts/setup/flush-memcached"
|
||||||
|
|
||||||
./manage.py migrate --noinput --settings=zproject.test_settings
|
./manage.py migrate --noinput --settings=zproject.test_settings
|
||||||
migration_status "var/migration_status_test"
|
./manage.py get_migration_status --settings=zproject.test_settings \
|
||||||
|
--output="var/migration_status_test"
|
||||||
|
|
||||||
# This next line can be simplified to "-n0" once we fix our app (and tests) with 0 messages.
|
# This next line can be simplified to "-n0" once we fix our app (and tests) with 0 messages.
|
||||||
./manage.py populate_db --settings=zproject.test_settings --test-suite -n30 \
|
./manage.py populate_db --settings=zproject.test_settings --test-suite -n30 \
|
||||||
|
|
|
@ -19,6 +19,14 @@ class Command(BaseCommand):
|
||||||
default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '
|
default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '
|
||||||
'Defaults to the "default" database.')
|
'Defaults to the "default" database.')
|
||||||
|
|
||||||
|
parser.add_argument('--output', action='store',
|
||||||
|
help='Path to store the status to (default to stdout).')
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
# type: (*Any, **Any) -> None
|
# type: (*Any, **Any) -> None
|
||||||
self.stdout.write(get_migration_status(**options))
|
result = get_migration_status(**options)
|
||||||
|
if options['output'] is not None:
|
||||||
|
with open(options['output'], 'w') as f:
|
||||||
|
f.write(result)
|
||||||
|
else:
|
||||||
|
self.stdout.write(result)
|
||||||
|
|
Loading…
Reference in New Issue