diff options
author | Jonne Haß <me@jhass.eu> | 2019-05-09 17:37:55 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2019-05-11 23:07:48 +0300 |
commit | 2d23a2601e744719f0696db209275cd85fdbb140 (patch) | |
tree | 4b8b16a2191693dac2bf38f3e7ad36f369140beb /db | |
parent | 39b86ed486be7e9bc4b906988b54111aa0e5d971 (diff) |
fix old photos without a remote_photo_path or remote_photo_name
closes #8012
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190509125709_fix_missing_remote_photo_fields.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/db/migrate/20190509125709_fix_missing_remote_photo_fields.rb b/db/migrate/20190509125709_fix_missing_remote_photo_fields.rb new file mode 100644 index 000000000..8d6462643 --- /dev/null +++ b/db/migrate/20190509125709_fix_missing_remote_photo_fields.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class FixMissingRemotePhotoFields < ActiveRecord::Migration[5.1] + def up + Photo.where(remote_photo_path: nil).each do |photo| + photo.write_attribute(:unprocessed_image, photo.read_attribute(:processed_image)) + photo.update_remote_path + photo.save! + end + end +end |