summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-09-21 21:01:58 -0600
committermo khan <mo@mokhan.ca>2014-09-21 21:01:58 -0600
commit4a0e0a9d2764272be3ffd471ce8aac02005c8cc6 (patch)
tree019d0b1a7855e0b53886b594fc544b79a5ebcebd /db
parentc4d58e1862c74d4af0824f6cad56f76b5298ef7f (diff)
change migration to a script.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20140921024709_migrate_avatars_to_photos.rb19
-rw-r--r--db/schema.rb2
2 files changed, 1 insertions, 20 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
diff --git a/db/schema.rb b/db/schema.rb
index 825289ef..5e98aa87 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140921024709) do
+ActiveRecord::Schema.define(version: 20140920033516) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"