Skip to content

Instantly share code, notes, and snippets.

@axavio
Created July 1, 2012 16:34

Revisions

  1. axavio revised this gist Jul 1, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ echo 'select id, guid, created_at, text, likes_count FROM posts WHERE author_id

    ## LIST PHOTOS
    # Set author_id to desired people table record id
    echo 'SELECT id, guid, status_message_guid, created_at, remote_photo_path || remote_photo_name AS name FROM photos ph WHERE author_id = ${1} ORDER BY id' | psql -U diaspora -h localhost -A -F '
    echo 'SELECT id, guid, status_message_guid, created_at, remote_photo_path || remote_photo_name AS name FROM photos ph WHERE author_id = 3 ORDER BY id' | psql -U diaspora -h localhost -A -F '
    ' -R '
    --- record
    ' diaspora_production > diaspora-photos.dump
  2. axavio created this gist Jul 1, 2012.
    39 changes: 39 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    # Handy commands to download a single user's data from a diaspora database by the podmin
    #
    # These are strictly manual. No attempt is made to make things nice for a production
    # environment where these scripts/commands might by run frequently.
    #
    # Original Source: gist by Pistos for posts and comments
    #
    # Caveats:
    #
    # POSTGRESQL ONLY! The psql command may be modified to a mysql command, but the flags/options are likely very different
    #
    # TESTED ON PISTOS-PODS ONLY! This is intended for use on pods where the diaspora database schema is circa January 2012.
    # It does not account for any changes made to the database structure after that point.
    #
    # Assumes role name is 'diaspora' and db name is 'diaspora_production'.
    #

    ## DUMP COMMENTS
    # 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


    ## DUMP POSTS
    # 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


    ## LIST PHOTOS
    # Set author_id to desired people table record id
    echo 'SELECT id, guid, status_message_guid, created_at, remote_photo_path || remote_photo_name AS name FROM photos ph WHERE author_id = ${1} ORDER BY id' | psql -U diaspora -h localhost -A -F '
    ' -R '
    --- record
    ' diaspora_production > diaspora-photos.dump