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

Commit

Permalink
Merge pull request #2337 from rubo77/patch-5
Browse files Browse the repository at this point in the history
nuke-room-from-db.sh: added postgresql option and help
  • Loading branch information
richvdh authored May 9, 2018
2 parents 678e649 + 6c957e2 commit d5377eb
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 d5377eb

Please sign in to comment.