Files
gerrit/devutil/export_safe.sh
Shawn O. Pearce 2f09570d60 export_safe: A script to scrub and export a Gerrit2 database
This script is just a simple tool to help me export the current
PostgreSQL database into a format that is safe to send to a 3rd
party.  All of the data is public on Gerrit's website, except for
the user's physical address contact information.  We scrub that
out because we do not have consent from our users to disclose
that information.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-26 16:19:24 -08:00

19 lines
335 B
Bash
Executable File

#!/bin/sh
src=reviewdb
tmp=safedump
N="N.$$.sql"
dropdb $tmp
pg_dump $src >$N &&
createdb -E UTF-8 $tmp &&
psql -f $N $tmp &&
psql -c 'UPDATE accounts SET
contact_address = NULL
,contact_country = NULL
,contact_phone_nbr = NULL
,contact_fax_nbr = NULL' $tmp &&
pg_dump $tmp | bzip2 -9 >gerrit2_dump.sql.bz2
dropdb $tmp
rm -f $N