Created
January 2, 2009 12:52
-
-
Save andrewtimberlake/42524 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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