summary refs log tree commit diff
path: root/scripts-dev/nuke-room-from-db.sh
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-05-06 12:54:07 +0100
committerMark Haines <mjark@negativecurvature.net>2015-05-06 12:54:07 +0100
commit3c11c9c122ec73c495bd691ba8608ad6a406b332 (patch)
tree8c9b339ce336b8d1dd45a3ac899c1875612236aa /scripts-dev/nuke-room-from-db.sh
parentMerge pull request #138 from matrix-org/erikj/SYN-371 (diff)
parentAcutally add scripts-dev/ (diff)
downloadsynapse-3c11c9c122ec73c495bd691ba8608ad6a406b332.tar.xz
Merge pull request #140 from matrix-org/erikj/scripts_refactor
Seperate scripts/ into scripts/ and scripts-dev/
Diffstat (limited to 'scripts-dev/nuke-room-from-db.sh')
-rwxr-xr-xscripts-dev/nuke-room-from-db.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts-dev/nuke-room-from-db.sh b/scripts-dev/nuke-room-from-db.sh
new file mode 100755
index 0000000000..58c036c896
--- /dev/null
+++ b/scripts-dev/nuke-room-from-db.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+## CAUTION:
+## This script will remove (hopefully) all trace of the given room ID from
+## your homeserver.db
+
+## Do not run it lightly.
+
+ROOMID="$1"
+
+sqlite3 homeserver.db <<EOF
+DELETE FROM context_depth WHERE context = '$ROOMID';
+DELETE FROM current_state WHERE context = '$ROOMID';
+DELETE FROM feedback WHERE room_id = '$ROOMID';
+DELETE FROM messages WHERE room_id = '$ROOMID';
+DELETE FROM pdu_backward_extremities WHERE context = '$ROOMID';
+DELETE FROM pdu_edges WHERE context = '$ROOMID';
+DELETE FROM pdu_forward_extremities WHERE context = '$ROOMID';
+DELETE FROM pdus WHERE context = '$ROOMID';
+DELETE FROM room_data WHERE room_id = '$ROOMID';
+DELETE FROM room_memberships WHERE room_id = '$ROOMID';
+DELETE FROM rooms WHERE room_id = '$ROOMID';
+DELETE FROM state_pdus WHERE context = '$ROOMID';
+EOF