Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
nuke-room-from-db.sh: added postgresql option and help
Browse files Browse the repository at this point in the history
  • Loading branch information
rubo77 committed May 8, 2018
1 parent 678e649 commit 6c957e2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts-dev/nuke-room-from-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 6c957e2

Please sign in to comment.