Permalink
Browse files

Updated migration generator template.

  • Loading branch information...
1 parent 32199e2 commit b7bfdec3b07cb348431510a3b400a40c110088c0 @dmitry dmitry committed Mar 18, 2012
Showing with 2 additions and 10 deletions.
  1. +2 −10 generators/paperclip/templates/paperclip_migration.rb.erb
@@ -1,19 +1,11 @@
class <%= migration_name %> < ActiveRecord::Migration
- def self.up
+ def change
<% attachments.each do |attachment| -%>
add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string
add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string
add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer
add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime
-<% end -%>
- end
-
- def self.down
-<% attachments.each do |attachment| -%>
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at
+ add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_fingerprint, :string, length: 32
<% end -%>
end
end

0 comments on commit b7bfdec

Please sign in to comment.