Commit 76ae4c4a
Changed files (3)
db/migrate/20121007153154_recreate_photos.rb
@@ -1,7 +1,7 @@
-class MigrateImagesToPhotos < ActiveRecord::Migration
+class RecreatePhotos < ActiveRecord::Migration
def up
Photo.all.each do |photo|
- puts "recreating versions for #{photo.id}"
+ puts "recreating #{photo.id}"
photo.image.recreate_versions!
end
end
db/migrate/20121007153155_migrate_images_to_photos.rb
@@ -1,6 +1,8 @@
class MigrateImagesToPhotos < ActiveRecord::Migration
def up
- add_column :photos, :is_primary, :boolean
+ add_column :photos, :is_primary, :boolean, :default => false
+
+ Photo.reset_column_information
Creation.all.each_with_index do |creation, index|
puts "#{index}. processing #{creation.name}"
photo = creation.photos.build({:is_primary => true})
db/schema.rb
@@ -127,11 +127,9 @@ ActiveRecord::Schema.define(:version => 20121007153155) do
t.string "image"
t.datetime "created_at"
t.datetime "updated_at"
- t.boolean "is_primary"
+ t.boolean "is_primary", :default => false
end
- add_index "photos", ["is_primary"], :name => "index_photos_on_is_primary"
-
create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"