From 05b9c08cfae65ce82817f967884879c6c6d2659d Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Fri, 25 Oct 2013 20:23:26 -0400 Subject: [PATCH] Add one-off tool for migrating our database user, schema, and db name from humbug to zulip (imported from commit 4b5e27eb3b083f2e2f2cabe64901f3dbaecd4739) --- tools/migrate-db | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tools/migrate-db diff --git a/tools/migrate-db b/tools/migrate-db new file mode 100644 index 0000000000..22a4f63d04 --- /dev/null +++ b/tools/migrate-db @@ -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);'"