mirror of https://github.com/zulip/zulip.git
Persist the tsearch_extras extension across rebuilding of the database
We do this by creating a new zulip{_test}_base database that only has the zulip schema and the tsearch_extras extension. We then use that as a template when creating zulip{_test}. (imported from commit 8adb4b98410e4042a0187902e89c99561eac8c8f)
This commit is contained in:
parent
17826dba42
commit
8767c33536
|
@ -1,6 +1,9 @@
|
||||||
#!/bin/sh -xe
|
#!/bin/sh -xe
|
||||||
|
|
||||||
echo "DROP SCHEMA zulip CASCADE; CREATE SCHEMA zulip;" | python manage.py dbshell
|
psql -h localhost postgres zulip <<EOF
|
||||||
|
DROP DATABASE IF EXISTS zulip;
|
||||||
|
CREATE DATABASE zulip TEMPLATE zulip_base;
|
||||||
|
EOF
|
||||||
|
|
||||||
python manage.py syncdb --noinput
|
python manage.py syncdb --noinput
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
|
|
|
@ -21,7 +21,11 @@ fi
|
||||||
|
|
||||||
mkdir -p zerver/fixtures
|
mkdir -p zerver/fixtures
|
||||||
|
|
||||||
echo "DROP SCHEMA zulip CASCADE; CREATE SCHEMA zulip;" | python manage.py dbshell --settings=zproject.test_settings
|
psql -h localhost postgres zulip_test <<EOF
|
||||||
|
DROP DATABASE IF EXISTS zulip_test;
|
||||||
|
CREATE DATABASE zulip_test TEMPLATE zulip_test_base;
|
||||||
|
EOF
|
||||||
|
|
||||||
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"
|
||||||
|
|
|
@ -24,6 +24,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DBNAME_BASE=${DBNAME}_base
|
||||||
|
|
||||||
$ROOT_POSTGRES $DEFAULT_DB << EOF
|
$ROOT_POSTGRES $DEFAULT_DB << EOF
|
||||||
CREATE USER $USERNAME WITH PASSWORD '$PASSWORD';
|
CREATE USER $USERNAME WITH PASSWORD '$PASSWORD';
|
||||||
|
@ -37,13 +38,21 @@ chmod go-rw ~/.pgpass
|
||||||
|
|
||||||
psql -h localhost postgres $USERNAME <<EOF
|
psql -h localhost postgres $USERNAME <<EOF
|
||||||
DROP DATABASE IF EXISTS $DBNAME;
|
DROP DATABASE IF EXISTS $DBNAME;
|
||||||
CREATE DATABASE $DBNAME;
|
DROP DATABASE IF EXISTS $DBNAME_BASE;
|
||||||
|
CREATE DATABASE $DBNAME_BASE
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
DEFAULT_DB=$DBNAME
|
psql -h localhost $DBNAME_BASE $USERNAME <<EOF
|
||||||
|
CREATE SCHEMA zulip;
|
||||||
|
EOF
|
||||||
|
|
||||||
$ROOT_POSTGRES $DEFAULT_DB << EOF
|
$ROOT_POSTGRES $DBNAME_BASE << EOF
|
||||||
DROP SCHEMA public CASCADE;
|
DROP SCHEMA public CASCADE;
|
||||||
|
CREATE EXTENSION tsearch_extras SCHEMA zulip;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
psql -h localhost postgres $USERNAME <<EOF
|
||||||
|
CREATE DATABASE $DBNAME TEMPLATE $DBNAME_BASE;
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo "Database created"
|
echo "Database created"
|
||||||
|
|
Loading…
Reference in New Issue