]> git.rm.cloudns.org Git - xonotic/xonstatdb.git/commitdiff
Add drop and load convenience script.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 11 Aug 2013 14:01:11 +0000 (10:01 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 11 Aug 2013 14:01:11 +0000 (10:01 -0400)
scripts/drop_and_load.shl [new file with mode: 0755]

diff --git a/scripts/drop_and_load.shl b/scripts/drop_and_load.shl
new file mode 100755 (executable)
index 0000000..8049afc
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# user doing the load - must be superuser, and must have access to postgres db
+USER=xonstat
+
+# full path to the backup file
+BACKUPFILE=$1
+
+psql -U $USER -h localhost postgres <<EOF
+drop database xonstatdb;
+create database xonstatdb encoding='utf-8' owner=xonstat;
+\q
+EOF
+
+pg_restore -c -U xonstat -h localhost -d xonstatdb $BACKUPFILE