fixed migration
This commit is contained in:
parent
75da4e560d
commit
ea3c7ec439
1 changed files with 2 additions and 2 deletions
|
|
@ -5,14 +5,14 @@ class FixPhotoShareVisibilities < ActiveRecord::Migration
|
||||||
raise 'migration currently only compatable with mysql' if postgres?
|
raise 'migration currently only compatable with mysql' if postgres?
|
||||||
|
|
||||||
if Photo.first.respond_to?(:tmp_old_id)
|
if Photo.first.respond_to?(:tmp_old_id)
|
||||||
['aspect_visibilities', 'share_visibilities'].each do
|
['aspect_visibilities', 'share_visibilities'].each do |vis_table|
|
||||||
ActiveRecord::Base.connection.execute <<SQL
|
ActiveRecord::Base.connection.execute <<SQL
|
||||||
UPDATE #{vis_table}
|
UPDATE #{vis_table}
|
||||||
SET shareable_type='Post'
|
SET shareable_type='Post'
|
||||||
SQL
|
SQL
|
||||||
ActiveRecord::Base.connection.execute <<SQL
|
ActiveRecord::Base.connection.execute <<SQL
|
||||||
UPDATE #{vis_table}, photos
|
UPDATE #{vis_table}, photos
|
||||||
SET #{vis_table}.shareable_type='Photo', #{vis_table}.shareable_id=photo.id
|
SET #{vis_table}.shareable_type='Photo', #{vis_table}.shareable_id=photos.id
|
||||||
WHERE #{vis_table}.shareable_id=photos.tmp_old_id
|
WHERE #{vis_table}.shareable_id=photos.tmp_old_id
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue