summaryrefslogtreecommitdiffstats
path: root/extra/sql_dumps/ident_table_snapshot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'extra/sql_dumps/ident_table_snapshot.sh')
-rwxr-xr-xextra/sql_dumps/ident_table_snapshot.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/extra/sql_dumps/ident_table_snapshot.sh b/extra/sql_dumps/ident_table_snapshot.sh
new file mode 100755
index 00000000..b887d796
--- /dev/null
+++ b/extra/sql_dumps/ident_table_snapshot.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -e -u -o pipefail
+
+DATESLUG="`date +%Y-%m-%d.%H%M%S`"
+DATABASE="fatcat"
+
+echo "Running SQL..."
+psql fatcat < ./dump_idents.sql
+
+CHANGELOG_REV="`head -n1 /tmp/fatcat_ident_latest_changelog.tsv`"
+OUTFILE="fatcat_idents.$DATESLUG.r$CHANGELOG_REV.tar.xz"
+
+echo "Compressing..."
+tar -C /tmp -c --xz --verbose \
+ -f $OUTFILE \
+ fatcat_ident_latest_changelog.tsv \
+ fatcat_ident_containers.tsv \
+ fatcat_ident_creators.tsv \
+ fatcat_ident_files.tsv \
+ fatcat_ident_releases.tsv \
+ fatcat_ident_works.tsv
+
+echo "Done: $OUTFILE"