#!/bin/sh -eu # This is a local development tool which sanitizes a production database # locally. # # Usage: # # ssh prod.database pg_dump database-name \ # | ./srht-replicate-db [-e ] [-x] database-name # # -x will delete extra data for a database dump which is suitable to give to # third parties by removing all non-public information. This is only supported # for git.sr.ht and hg.sr.ht. email_domain=example.org export_grade=0 while getopts e: name do case $name in e) email_domain="$OPTARG" ;; x) export_grade=1 ;; ?) echo "Invalid usage" >&2 exit 1 ;; esac done shift $((OPTIND-1)) if [ $# -ne 1 ] then echo "Invalid usage" >&2 exit 1 fi database="$1" dropdb "$database"