diff options
| author | mo khan <mo@mokhan.ca> | 2014-09-21 21:01:58 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-09-21 21:01:58 -0600 |
| commit | 4a0e0a9d2764272be3ffd471ce8aac02005c8cc6 (patch) | |
| tree | 019d0b1a7855e0b53886b594fc544b79a5ebcebd /db/migrate | |
| parent | c4d58e1862c74d4af0824f6cad56f76b5298ef7f (diff) | |
change migration to a script.
Diffstat (limited to 'db/migrate')
| -rw-r--r-- | db/migrate/20140921024709_migrate_avatars_to_photos.rb | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/db/migrate/20140921024709_migrate_avatars_to_photos.rb b/db/migrate/20140921024709_migrate_avatars_to_photos.rb deleted file mode 100644 index 18d01235..00000000 --- a/db/migrate/20140921024709_migrate_avatars_to_photos.rb +++ /dev/null @@ -1,19 +0,0 @@ -class MigrateAvatarsToPhotos < ActiveRecord::Migration - def change - BlobStorage.new.tap do |blob_storage| - Avatar.includes(:user).where('avatar IS NOT NULL').find_each do |avatar| - begin - user = avatar.user - key = avatar.avatar.path - blob_storage.download(key) do |file| - user.avatar = Photo.create! - user.avatar.upload(file.path, blob_storage) - user.avatar.save! - end - rescue StandardError => error - say error.message - end - end - end - end -end |
