Added PostgreSQL-compatible version of SQL for migration (MovePhotosToTheirOwnTable).
This commit is contained in:
parent
61ae843193
commit
f04af4c493
1 changed files with 7 additions and 2 deletions
|
|
@ -26,8 +26,13 @@ FROM posts
|
|||
WHERE type = 'Photo'
|
||||
SQL
|
||||
|
||||
if postgres?
|
||||
execute "UPDATE aspect_visibilities AS av SET shareable_type='Photo' FROM photos WHERE av.shareable_id=photos.id"
|
||||
execute "UPDATE share_visibilities AS sv SET shareable_type='Photo' FROM photos WHERE sv.shareable_id=photos.id"
|
||||
else
|
||||
execute "UPDATE aspect_visibilities AS av, photos SET av.shareable_type='Photo' WHERE av.shareable_id=photos.id"
|
||||
execute "UPDATE share_visibilities AS sv, photos SET sv.shareable_type='Photo' WHERE sv.shareable_id=photos.id"
|
||||
end
|
||||
|
||||
# all your base are belong to us!
|
||||
execute "DELETE FROM posts WHERE type='Photo'"
|
||||
|
|
|
|||
Loading…
Reference in a new issue