Skip to content

Instantly share code, notes, and snippets.

@Pistos
Created October 22, 2011 17:50
Show Gist options
  • Select an option

  • Save Pistos/1306275 to your computer and use it in GitHub Desktop.

Select an option

Save Pistos/1306275 to your computer and use it in GitHub Desktop.
if postgres?
execute %{
INSERT INTO photos (
tmp_old_id
, author_id
, public
, diaspora_handle
, guid
, pending
, text
, remote_photo_path
, remote_photo_name
, random_string
, processed_image
, created_at
, updated_at
, unprocessed_image
, status_message_guid
, comments_count
) SELECT
id
, author_id
, public
, diaspora_handle
, guid
, pending
, text
, remote_photo_path
, remote_photo_name
, random_string
, processed_image
, created_at
, updated_at
, unprocessed_image
, status_message_guid
, comments_count
FROM
posts
WHERE
type = 'Photo'
}
execute "UPDATE aspect_visibilities SET shareable_type='Photo' FROM photos WHERE shareable_id=photos.id"
execute "UPDATE share_visibilities SET shareable_type='Photo' FROM photos WHERE shareable_id=photos.id"
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment