summary refs log tree commit diff
path: root/scripts-dev/nuke-room-from-db.sh
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-05-09 15:31:33 +0100
committerErik Johnston <erik@matrix.org>2018-05-09 15:31:33 +0100
commit9896dab8f6cbdf1cdac4549e20e4ed0ba17d5655 (patch)
treee288da53414d96fc48ea02e38aa33a4b449c31da /scripts-dev/nuke-room-from-db.sh
parentRefactor get_recent_events_for_room return type (diff)
parentMerge pull request #3196 from matrix-org/erikj/pagination_return (diff)
downloadsynapse-9896dab8f6cbdf1cdac4549e20e4ed0ba17d5655.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/fixup_return_pagination
Diffstat (limited to 'scripts-dev/nuke-room-from-db.sh')
-rwxr-xr-xscripts-dev/nuke-room-from-db.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts-dev/nuke-room-from-db.sh b/scripts-dev/nuke-room-from-db.sh
index 1201d176c2..c62928afdb 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';
@@ -29,7 +39,7 @@ DELETE FROM state_groups WHERE room_id = '$ROOMID';
 DELETE FROM state_groups_state WHERE room_id = '$ROOMID';
 DELETE FROM receipts_graph WHERE room_id = '$ROOMID';
 DELETE FROM receipts_linearized WHERE room_id = '$ROOMID';
-DELETE FROM event_search_content WHERE c1room_id = '$ROOMID';
+DELETE FROM event_search WHERE room_id = '$ROOMID'; 
 DELETE FROM guest_access WHERE room_id = '$ROOMID';
 DELETE FROM history_visibility WHERE room_id = '$ROOMID';
 DELETE FROM room_tags WHERE room_id = '$ROOMID';