Added missing rollback for photo migration.
This commit is contained in:
parent
0be85dff2d
commit
982e6f9b6b
1 changed files with 31 additions and 2 deletions
|
|
@ -48,7 +48,35 @@ INSERT INTO posts
|
||||||
FROM photos
|
FROM photos
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
execute <<SQL
|
if postgres?
|
||||||
|
execute %{
|
||||||
|
UPDATE
|
||||||
|
aspect_visibilities
|
||||||
|
SET
|
||||||
|
shareable_id=posts.id
|
||||||
|
, shareable_type='Post'
|
||||||
|
FROM
|
||||||
|
posts
|
||||||
|
, photos
|
||||||
|
WHERE
|
||||||
|
posts.guid=photos.guid
|
||||||
|
AND photos.id=aspect_visibilities.shareable_id
|
||||||
|
}
|
||||||
|
execute %{
|
||||||
|
UPDATE
|
||||||
|
share_visibilities
|
||||||
|
SET
|
||||||
|
shareable_id=posts.id
|
||||||
|
, shareable_type='Post'
|
||||||
|
FROM
|
||||||
|
posts
|
||||||
|
, photos
|
||||||
|
WHERE
|
||||||
|
posts.guid=photos.guid
|
||||||
|
AND photos.id=share_visibilities.shareable_id
|
||||||
|
}
|
||||||
|
else
|
||||||
|
execute <<SQL
|
||||||
UPDATE aspect_visibilities, posts, photos
|
UPDATE aspect_visibilities, posts, photos
|
||||||
SET
|
SET
|
||||||
aspect_visibilities.shareable_id=posts.id,
|
aspect_visibilities.shareable_id=posts.id,
|
||||||
|
|
@ -58,7 +86,7 @@ posts.guid=photos.guid AND
|
||||||
photos.id=aspect_visibilities.shareable_id
|
photos.id=aspect_visibilities.shareable_id
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
execute <<SQL
|
execute <<SQL
|
||||||
UPDATE share_visibilities, posts, photos
|
UPDATE share_visibilities, posts, photos
|
||||||
SET
|
SET
|
||||||
share_visibilities.shareable_id=posts.id,
|
share_visibilities.shareable_id=posts.id,
|
||||||
|
|
@ -67,6 +95,7 @@ WHERE
|
||||||
posts.guid=photos.guid AND
|
posts.guid=photos.guid AND
|
||||||
photos.id=share_visibilities.shareable_id
|
photos.id=share_visibilities.shareable_id
|
||||||
SQL
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
execute "DROP TABLE photos"
|
execute "DROP TABLE photos"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue