Files
reddit/scripts/migrate/dump-rel.sh
Neil Williams 68291521b5 Move query_cache scripts to a more general "migrate" directory.
Not just for the query cache anymore!
2012-12-04 11:41:24 -08:00

19 lines
434 B
Bash
Executable File

#!/bin/bash
set -x
set -e
RELNAME=$1
cat <<DUMP_REL | ./run-query.sh
SET enable_bitmapscan=false;
\\copy(SELECT rel_id, thing1_id, thing2_id, name, EXTRACT(epoch FROM date) FROM reddit_rel_$RELNAME) to 'input/$RELNAME.dump';
DUMP_REL
cat <<DUMP_RELDATA | ./run-query.sh
SET enable_bitmapscan=false;
\\copy (SELECT thing_id, key, value FROM reddit_data_rel_$RELNAME WHERE key = 'new') to 'input/$RELNAME-data.dump';
DUMP_RELDATA