Skip to content

Instantly share code, notes, and snippets.

@Pistos
Created June 22, 2012 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pistos/2975316 to your computer and use it in GitHub Desktop.
Save Pistos/2975316 to your computer and use it in GitHub Desktop.
Dumping posts and comments out of Diaspora database
# Set author_id to desired people table record id
echo 'SELECT c.id, c.guid, p.guid AS post_guid, c.created_at, c.text, c.likes_count FROM comments c, posts p WHERE p.id = c.commentable_id AND c.author_id = 3 ORDER BY c.id' | psql -U diaspora -h localhost -A -F '
' -R '
--- record
' diaspora_production > diaspora-comments.dump
# Set author_id to desired people table record id
echo 'select id, guid, created_at, text, likes_count FROM posts WHERE author_id = 3 order by id' | psql -U diaspora -h localhost -A -F '
' -R '
--- record
' diaspora_production > diaspora-posts.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment