summary refs log tree commit diff
path: root/scripts-dev/nuke-room-from-db.sh
diff options
context:
space:
mode:
authorrubo77 <github@r.z11.de>2018-05-09 00:14:01 +0200
committerrubo77 <github@r.z11.de>2018-05-09 00:14:01 +0200
commit6c957e26f06f5806ae2e69838865ee2990a75258 (patch)
treee97f60cd73adf4bbacb27cdd6aa8b951f2ed185a /scripts-dev/nuke-room-from-db.sh
parentMerge pull request #3190 from mujx/notif-token-fix (diff)
downloadsynapse-6c957e26f06f5806ae2e69838865ee2990a75258.tar.xz
nuke-room-from-db.sh: added postgresql option and help
Diffstat (limited to '')
-rwxr-xr-xscripts-dev/nuke-room-from-db.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts-dev/nuke-room-from-db.sh b/scripts-dev/nuke-room-from-db.sh
index 1201d176c2..cd74d78d6a 100755
--- a/scripts-dev/nuke-room-from-db.sh
+++ b/scripts-dev/nuke-room-from-db.sh
@@ -6,9 +6,19 @@
 
 ## Do not run it lightly.
 
+set -e
+
+if [ "$1" == "-h" ] || [ "$1" == "" ]; then
+  echo "Call with ROOM_ID as first option and then pipe it into the database. So for instance you might run"
+  echo " nuke-room-from-db.sh <room_id> | sqlite3 homeserver.db"
+  echo "or"
+  echo " nuke-room-from-db.sh <room_id> | psql --dbname=synapse"
+  exit
+fi
+
 ROOMID="$1"
 
-sqlite3 homeserver.db <<EOF
+cat <<EOF
 DELETE FROM event_forward_extremities WHERE room_id = '$ROOMID';
 DELETE FROM event_backward_extremities WHERE room_id = '$ROOMID';
 DELETE FROM event_edges WHERE room_id = '$ROOMID';