aboutsummaryrefslogtreecommitdiffstats
path: root/extra/sql_dumps/dump_file_hashes.sql
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-13 00:23:09 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-13 00:23:09 -0700
commit9f25d84accb5a3657cb4c7dd87014d9f13ccf2ef (patch)
tree4854b13512c65fd0bffddfb791c4c014a41088dc /extra/sql_dumps/dump_file_hashes.sql
parentaa9abbbab67c6344d382a964b3c451e0bf212efe (diff)
downloadfatcat-9f25d84accb5a3657cb4c7dd87014d9f13ccf2ef.tar.gz
fatcat-9f25d84accb5a3657cb4c7dd87014d9f13ccf2ef.zip
improve dump scripts
Diffstat (limited to 'extra/sql_dumps/dump_file_hashes.sql')
-rw-r--r--extra/sql_dumps/dump_file_hashes.sql11
1 files changed, 11 insertions, 0 deletions
diff --git a/extra/sql_dumps/dump_file_hashes.sql b/extra/sql_dumps/dump_file_hashes.sql
new file mode 100644
index 00000000..a84c2ee1
--- /dev/null
+++ b/extra/sql_dumps/dump_file_hashes.sql
@@ -0,0 +1,11 @@
+
+BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE;
+
+COPY (SELECT file_ident.id, file_rev.id, file_rev.sha1, file_rev.sha256, file_rev.md5
+ FROM file_rev
+ INNER JOIN file_ident ON file_ident.rev_id = file_rev.id
+ WHERE file_ident.is_live = 't' AND file_ident.redirect_id IS NULL)
+ TO STDOUT
+ WITH NULL '';
+
+ROLLBACK;