diff options
author | Pistos <github.pistos@purepistos.net> | 2011-10-17 17:42:22 +0400 |
---|---|---|
committer | Pistos <github.pistos@purepistos.net> | 2011-10-17 17:42:22 +0400 |
commit | f04af4c4937cf653ff59705c9a7270bc3768fcc7 (patch) | |
tree | 071b6f701930db6a4d7490c00106070e22c07194 /db | |
parent | 61ae84319337286ffee9f96c1eefcc02a63580a9 (diff) |
Added PostgreSQL-compatible version of SQL for migration (MovePhotosToTheirOwnTable).
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20111012215141_move_photos_to_their_own_table.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/db/migrate/20111012215141_move_photos_to_their_own_table.rb b/db/migrate/20111012215141_move_photos_to_their_own_table.rb index 8c7479934..0bec98f25 100644 --- a/db/migrate/20111012215141_move_photos_to_their_own_table.rb +++ b/db/migrate/20111012215141_move_photos_to_their_own_table.rb @@ -26,8 +26,13 @@ FROM posts WHERE type = 'Photo' SQL - 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" + 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'" |