diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2019-07-04 02:47:55 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2019-07-04 03:29:17 +0300 |
commit | b42c9896bc62e17be267e682f280f39877108e53 (patch) | |
tree | 596e8dbd304b3ca00931e34b49be4b7915e3cc44 /db | |
parent | df4e79b842fa16b370c8c4b07b82bdd328f3ef7e (diff) |
Migrate pending profile photos and fix upload to unpend profile photos
fixes #8043
closes #8044
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190703231700_fix_pending_profile_photos.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/db/migrate/20190703231700_fix_pending_profile_photos.rb b/db/migrate/20190703231700_fix_pending_profile_photos.rb new file mode 100644 index 000000000..51b3a1512 --- /dev/null +++ b/db/migrate/20190703231700_fix_pending_profile_photos.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class FixPendingProfilePhotos < ActiveRecord::Migration[5.1] + def up + Photo.where(pending: true).each do |photo| + photo.update(pending: false) if Profile.where(image_url: photo.url(:thumb_large)).exists? + end + end +end |