database-prepare-for-0.5.0.sh 342 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # This is will prepare a synapse database for running with v0.5.0 of synapse.
  3. # It will store all the user information, but will *delete* all messages and
  4. # room data.
  5. set -e
  6. cp "$1" "$1.bak"
  7. DUMP=$(sqlite3 "$1" << 'EOF'
  8. .dump users
  9. .dump access_tokens
  10. .dump presence
  11. .dump profiles
  12. EOF
  13. )
  14. rm "$1"
  15. sqlite3 "$1" <<< "$DUMP"