summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-07-05 17:26:10 -0600
committermo khan <mo@mokhan.ca>2014-07-05 17:26:10 -0600
commitbd487422a0bc6e94d90686531de7b12a3fa12540 (patch)
tree53d213af6fb7406591deae09a40d36236c3b3c72 /db
parent92da5f98f65ecfb51e8bb6571325c174588e4757 (diff)
migrate watermarks from creations to photos.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20140705232142_move_watermarks_from_creations_to_photos.rb8
-rw-r--r--db/schema.rb2
2 files changed, 9 insertions, 1 deletions
diff --git a/db/migrate/20140705232142_move_watermarks_from_creations_to_photos.rb b/db/migrate/20140705232142_move_watermarks_from_creations_to_photos.rb
new file mode 100644
index 00000000..f0a98c97
--- /dev/null
+++ b/db/migrate/20140705232142_move_watermarks_from_creations_to_photos.rb
@@ -0,0 +1,8 @@
+class MoveWatermarksFromCreationsToPhotos < ActiveRecord::Migration
+ def change
+ Photo.includes(:creation).find_each do |photo|
+ say("migrating watermark: #{photo.creation.watermark} to #{photo.id}")
+ photo.update_attribute(:watermark, photo.creation.watermark) if photo.creation.watermark.present?
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 2277abca..bb3e4842 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: 20140705231829) do
+ActiveRecord::Schema.define(version: 20140705232142) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"