Add one-off tool for migrating our database user, schema, and db name from humbug to zulip

(imported from commit 4b5e27eb3b083f2e2f2cabe64901f3dbaecd4739)
This commit is contained in:
Zev Benjamin 2013-10-25 20:23:26 -04:00
parent 13768495a6
commit 05b9c08cfa
1 changed files with 20 additions and 0 deletions

20
tools/migrate-db Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash -xe
su postgres -c "psql -c 'ALTER USER humbug RENAME TO zulip;'"
# On a local dev instance, you have to uncomment these lines:
#su postgres -c "psql -c \"ALTER USER zulip PASSWORD 'xxxxxxxxxxxx';\""
#su postgres -c "psql -c 'DROP USER humbug_test;'"
#su postgres -c "psql -c 'DROP DATABASE IF EXISTS humbug_test;'"
#su postgres -c "psql -c 'DROP DATABASE IF EXISTS humbug_test_template;'"
#tools/postgres-init-test-db
#tools/do-destroy-rebuild-test-database
su postgres -c "psql -c 'ALTER DATABASE humbug RENAME TO zulip;'"
su zulip -c "psql -c 'ALTER SCHEMA humbug RENAME TO zulip;'"
su zulip -c "psql -c 'ALTER ROLE zulip SET search_path TO zulip,public;'"
# On a local dev instance, you will need to adjust this path
mv /usr/share/postgresql/9.1/tsearch_data/humbug_english.stop /usr/share/postgresql/9.1/tsearch_data/zulip_english.stop
su zulip -c "psql -c 'ALTER TEXT SEARCH DICTIONARY zulip.english_us_hunspell (StopWords = zulip_english);'"