Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewtimberlake/42524 to your computer and use it in GitHub Desktop.
Save andrewtimberlake/42524 to your computer and use it in GitHub Desktop.
class ChangePhotoFromAttachmentFuToPaperclip < ActiveRecord::Migration
def self.up
#Reorganise the actual photos on AWS to suit the RWS/Paperclip schema
#Rename attachement_fu columns to paperclip convention
rename_column :photos, :filename, :photo_file_name
rename_column :photos, :content_type, :photo_content_type
rename_column :photos, :size, :photo_file_size
#Remove non-paperclip columns
remove_column :photos, :width
remove_column :photos, :height
remove_column :photos, :thumbnail
#Remove all child records (attachment_fu)
Photo.delete_all('parent_id is not null')
remove_column :photos, :parent_id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment