nuke-room-from-db.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 event_forward_extremities WHERE room_id = '$ROOMID';
  9. DELETE FROM event_backward_extremities WHERE room_id = '$ROOMID';
  10. DELETE FROM event_edges WHERE room_id = '$ROOMID';
  11. DELETE FROM room_depth WHERE room_id = '$ROOMID';
  12. DELETE FROM state_forward_extremities WHERE room_id = '$ROOMID';
  13. DELETE FROM events WHERE room_id = '$ROOMID';
  14. DELETE FROM event_json WHERE room_id = '$ROOMID';
  15. DELETE FROM state_events WHERE room_id = '$ROOMID';
  16. DELETE FROM current_state_events WHERE room_id = '$ROOMID';
  17. DELETE FROM room_memberships WHERE room_id = '$ROOMID';
  18. DELETE FROM feedback WHERE room_id = '$ROOMID';
  19. DELETE FROM topics WHERE room_id = '$ROOMID';
  20. DELETE FROM room_names WHERE room_id = '$ROOMID';
  21. DELETE FROM rooms WHERE room_id = '$ROOMID';
  22. DELETE FROM room_hosts WHERE room_id = '$ROOMID';
  23. DELETE FROM room_aliases WHERE room_id = '$ROOMID';
  24. DELETE FROM state_groups WHERE room_id = '$ROOMID';
  25. DELETE FROM state_groups_state WHERE room_id = '$ROOMID';
  26. DELETE FROM receipts_graph WHERE room_id = '$ROOMID';
  27. DELETE FROM receipts_linearized WHERE room_id = '$ROOMID';
  28. DELETE FROM event_search_content WHERE c1room_id = '$ROOMID';
  29. DELETE FROM guest_access WHERE room_id = '$ROOMID';
  30. DELETE FROM history_visibility WHERE room_id = '$ROOMID';
  31. DELETE FROM room_tags WHERE room_id = '$ROOMID';
  32. DELETE FROM room_tags_revisions WHERE room_id = '$ROOMID';
  33. DELETE FROM room_account_data WHERE room_id = '$ROOMID';
  34. DELETE FROM event_push_actions WHERE room_id = '$ROOMID';
  35. DELETE FROM local_invites WHERE room_id = '$ROOMID';
  36. DELETE FROM pusher_throttle WHERE room_id = '$ROOMID';
  37. DELETE FROM event_reports WHERE room_id = '$ROOMID';
  38. DELETE FROM public_room_list_stream WHERE room_id = '$ROOMID';
  39. DELETE FROM stream_ordering_to_exterm WHERE room_id = '$ROOMID';
  40. DELETE FROM event_auth WHERE room_id = '$ROOMID';
  41. DELETE FROM appservice_room_list WHERE room_id = '$ROOMID';
  42. VACUUM;
  43. EOF