nuke-room-from-db.sh 817 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. ## CAUTION:
  3. ## This script will remove (hopefully) all trace of the given room ID from
  4. ## your homeserver.db
  5. ## Do not run it lightly.
  6. ROOMID="$1"
  7. sqlite3 homeserver.db <<EOF
  8. DELETE FROM context_depth WHERE context = '$ROOMID';
  9. DELETE FROM current_state WHERE context = '$ROOMID';
  10. DELETE FROM feedback WHERE room_id = '$ROOMID';
  11. DELETE FROM messages WHERE room_id = '$ROOMID';
  12. DELETE FROM pdu_backward_extremities WHERE context = '$ROOMID';
  13. DELETE FROM pdu_edges WHERE context = '$ROOMID';
  14. DELETE FROM pdu_forward_extremities WHERE context = '$ROOMID';
  15. DELETE FROM pdus WHERE context = '$ROOMID';
  16. DELETE FROM room_data WHERE room_id = '$ROOMID';
  17. DELETE FROM room_memberships WHERE room_id = '$ROOMID';
  18. DELETE FROM rooms WHERE room_id = '$ROOMID';
  19. DELETE FROM state_pdus WHERE context = '$ROOMID';
  20. EOF