Files
gerrit/gerrit1_import/export_safe.sh
Shawn O. Pearce 47369dee03 Rename top level directory devutil to gerrit1_import
Really this directory exists to support the Gerrit1 -> 2 upgrade,
and not as utilities for development.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2009-02-02 16:04:39 -08:00

26 lines
539 B
Bash
Executable File

#!/bin/sh
# This script assumes the Gerrit1 import has already been
# renamed to 'gerrit1' schema:
#
# psql -c 'ALTER SCHEMA public RENAME TO gerrit1' $src
#
src=android_codereview
tmp=safedump
N="N.$$.sql"
dropdb $tmp
createdb -E UTF-8 $tmp &&
pg_dump -O -Fc $src >$N &&
pg_restore -d $tmp $N &&
psql -c 'UPDATE gerrit1.accounts SET
mailing_address = NULL
,mailing_address_country = NULL
,phone_number = NULL
,fax_number = NULL
,cla_comments = NULL' $tmp &&
pg_dump -O -Fc $tmp | bzip2 -9 >gerrit1.dump.bz2
dropdb $tmp
rm -f $N