[manual] Change references to the humbug_test user, schema, and database to zulip_test

This requires no changes in production, but is tagged as manual to
remind developers that they need to edit and run the tools/migrate-db
script to fix up their local database instances.

(imported from commit fbf764fb61592ef994d6d2ad56edad65ff01f14b)
This commit is contained in:
Zev Benjamin 2013-10-25 22:24:40 -04:00
parent 7b6f6823a5
commit cdcbe61cb0
3 changed files with 14 additions and 15 deletions

View File

@ -4,16 +4,16 @@ function migration_status {
./manage.py migrate --list | sed 's/*/ /' > "$1" ./manage.py migrate --list | sed 's/*/ /' > "$1"
} }
template_grep_error_code=$(echo "SELECT 1 from pg_database WHERE datname='humbug_test_template';" | python manage.py dbshell --settings=zproject.test_settings | grep -q "1 row"; echo $?) template_grep_error_code=$(echo "SELECT 1 from pg_database WHERE datname='zulip_test_template';" | python manage.py dbshell --settings=zproject.test_settings | grep -q "1 row"; echo $?)
if [ $template_grep_error_code == "0" ]; then if [ $template_grep_error_code == "0" ]; then
migration_status zerver/fixtures/available-migrations migration_status zerver/fixtures/available-migrations
if [ -e zerver/fixtures/migration-status ] && if [ -e zerver/fixtures/migration-status ] &&
cmp -s zerver/fixtures/available-migrations zerver/fixtures/migration-status && cmp -s zerver/fixtures/available-migrations zerver/fixtures/migration-status &&
[ "$1" != "--force" ]; then [ "$1" != "--force" ]; then
psql -h localhost postgres humbug_test << EOF psql -h localhost postgres zulip_test << EOF
DROP DATABASE humbug_test; DROP DATABASE zulip_test;
CREATE DATABASE humbug_test TEMPLATE humbug_test_template; CREATE DATABASE zulip_test TEMPLATE zulip_test_template;
EOF EOF
exit 0 exit 0
fi fi
@ -26,7 +26,7 @@ mkdir -p zerver/fixtures
rm -f zerver/lib/time.pyc rm -f zerver/lib/time.pyc
echo "DROP SCHEMA humbug CASCADE; CREATE SCHEMA humbug;" | python manage.py dbshell --settings=zproject.test_settings echo "DROP SCHEMA zulip CASCADE; CREATE SCHEMA zulip;" | python manage.py dbshell --settings=zproject.test_settings
python manage.py syncdb --noinput --settings=zproject.test_settings python manage.py syncdb --noinput --settings=zproject.test_settings
python manage.py migrate --settings=zproject.test_settings --all python manage.py migrate --settings=zproject.test_settings --all
migration_status "zerver/fixtures/migration-status" migration_status "zerver/fixtures/migration-status"
@ -41,7 +41,7 @@ python manage.py dumpdata --settings=zproject.test_settings \
zerver.DefaultStream > zerver/fixtures/messages.json zerver.DefaultStream > zerver/fixtures/messages.json
# create pristine template database, for fast fixture restoration after tests are run. # create pristine template database, for fast fixture restoration after tests are run.
psql -h localhost postgres humbug_test << EOF psql -h localhost postgres zulip_test << EOF
DROP DATABASE humbug_test_template; DROP DATABASE zulip_test_template;
CREATE DATABASE humbug_test_template TEMPLATE humbug_test; CREATE DATABASE zulip_test_template TEMPLATE zulip_test;
EOF EOF

View File

@ -1,4 +1,3 @@
#/bin/sh -xe #/bin/sh -xe
$(dirname $0)/postgres-init-db humbug_test xxxxxxxxxxxx humbug_test humbug,public $(dirname $0)/postgres-init-db zulip_test xxxxxxxxxxxx zulip_test zulip,public

View File

@ -1,13 +1,13 @@
from settings import * from settings import *
import os import os
DATABASES["default"] = {"NAME": "humbug_test", DATABASES["default"] = {"NAME": "zulip_test",
"USER": "humbug_test", "USER": "zulip_test",
"PASSWORD": "xxxxxxxxxxxx", "PASSWORD": "xxxxxxxxxxxx",
"HOST": "localhost", "HOST": "localhost",
"SCHEMA": "humbug", "SCHEMA": "zulip",
"ENGINE": "django.db.backends.postgresql_psycopg2", "ENGINE": "django.db.backends.postgresql_psycopg2",
"TEST_NAME": "django_humbug_tests", "TEST_NAME": "django_zulip_tests",
"OPTIONS": { },} "OPTIONS": { },}
@ -39,7 +39,7 @@ TUTORIAL_ENABLED = False
# Disable use of memcached for caching # Disable use of memcached for caching
CACHES['database'] = { CACHES['database'] = {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache', 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
'LOCATION': 'humbug-database-test-cache', 'LOCATION': 'zulip-database-test-cache',
'TIMEOUT': 3600, 'TIMEOUT': 3600,
'OPTIONS': { 'OPTIONS': {
'MAX_ENTRIES': 100000 'MAX_ENTRIES': 100000