Skip to content

Instantly share code, notes, and snippets.

@maakuth
Created December 20, 2019 17:48
Show Gist options
  • Save maakuth/b5d58d4aa5b0fdbb3590a5c0b8017f12 to your computer and use it in GitHub Desktop.
Save maakuth/b5d58d4aa5b0fdbb3590a5c0b8017f12 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
rooms = `sudo -u postgres psql synapse -t -c "select room_id from rooms;"`.split("\n")
rooms.reject! {|r| r.strip == "" }
rooms.each_with_index do |r, i|
`./synapse-compress-state -p 'postgresql://USERNAME:PASSWORD@HOSTNAME/DBNAME' -r '#{r.strip}' -o out#{i}.sql -t`
end
@maakuth
Copy link
Author

maakuth commented Dec 20, 2019

Leaves you with a number of out[number].sql-files. You can apply them via sudo -u postgres psql synapse < *.sql

No warranty for any stuff you copy paste out of random gists, obviously ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment