Fixed Pistos' issue in downmigration
This commit is contained in:
parent
d8e410f242
commit
a91932c576
1 changed files with 41 additions and 42 deletions
|
|
@ -21,45 +21,45 @@ class MovePhotosToTheirOwnTable < ActiveRecord::Migration
|
||||||
|
|
||||||
if postgres?
|
if postgres?
|
||||||
execute %{
|
execute %{
|
||||||
INSERT INTO photos (
|
INSERT INTO photos (
|
||||||
tmp_old_id
|
tmp_old_id
|
||||||
, author_id
|
, author_id
|
||||||
, public
|
, public
|
||||||
, diaspora_handle
|
, diaspora_handle
|
||||||
, guid
|
, guid
|
||||||
, pending
|
, pending
|
||||||
, text
|
, text
|
||||||
, remote_photo_path
|
, remote_photo_path
|
||||||
, remote_photo_name
|
, remote_photo_name
|
||||||
, random_string
|
, random_string
|
||||||
, processed_image
|
, processed_image
|
||||||
, created_at
|
, created_at
|
||||||
, updated_at
|
, updated_at
|
||||||
, unprocessed_image
|
, unprocessed_image
|
||||||
, status_message_guid
|
, status_message_guid
|
||||||
, comments_count
|
, comments_count
|
||||||
) SELECT
|
) SELECT
|
||||||
id
|
id
|
||||||
, author_id
|
, author_id
|
||||||
, public
|
, public
|
||||||
, diaspora_handle
|
, diaspora_handle
|
||||||
, guid
|
, guid
|
||||||
, pending
|
, pending
|
||||||
, text
|
, text
|
||||||
, remote_photo_path
|
, remote_photo_path
|
||||||
, remote_photo_name
|
, remote_photo_name
|
||||||
, random_string
|
, random_string
|
||||||
, processed_image
|
, processed_image
|
||||||
, created_at
|
, created_at
|
||||||
, updated_at
|
, updated_at
|
||||||
, unprocessed_image
|
, unprocessed_image
|
||||||
, status_message_guid
|
, status_message_guid
|
||||||
, comments_count
|
, comments_count
|
||||||
FROM
|
FROM
|
||||||
posts
|
posts
|
||||||
WHERE
|
WHERE
|
||||||
type = 'Photo'
|
type = 'Photo'
|
||||||
}
|
}
|
||||||
|
|
||||||
execute "UPDATE aspect_visibilities SET shareable_type='Photo' FROM photos WHERE shareable_id=photos.id"
|
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"
|
execute "UPDATE share_visibilities SET shareable_type='Photo' FROM photos WHERE shareable_id=photos.id"
|
||||||
|
|
@ -85,7 +85,7 @@ SQL
|
||||||
if postgres?
|
if postgres?
|
||||||
execute %{
|
execute %{
|
||||||
INSERT INTO posts (
|
INSERT INTO posts (
|
||||||
tmp_old_id, author_id, public, diaspora_handle, guid, pending, type, text,
|
id, author_id, public, diaspora_handle, guid, pending, type, text,
|
||||||
remote_photo_path, remote_photo_name, random_string, processed_image,
|
remote_photo_path, remote_photo_name, random_string, processed_image,
|
||||||
youtube_titles, created_at, updated_at, unprocessed_image,
|
youtube_titles, created_at, updated_at, unprocessed_image,
|
||||||
object_url, image_url, image_height, image_width,
|
object_url, image_url, image_height, image_width,
|
||||||
|
|
@ -95,8 +95,7 @@ SQL
|
||||||
tmp_old_id, author_id, public, diaspora_handle, guid, pending, 'Photo', text,
|
tmp_old_id, author_id, public, diaspora_handle, guid, pending, 'Photo', text,
|
||||||
remote_photo_path, remote_photo_name, random_string, processed_image,
|
remote_photo_path, remote_photo_name, random_string, processed_image,
|
||||||
NULL, created_at, updated_at, unprocessed_image, NULL, NULL, NULL, NULL,
|
NULL, created_at, updated_at, unprocessed_image, NULL, NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL, status_message_guid, 0, comments_count, NULL
|
||||||
status_message_guid, 0, comments_count, NULL
|
|
||||||
FROM photos
|
FROM photos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue