Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Revert "Updated migration generator template."
Browse files Browse the repository at this point in the history
Rails 3.0.x doesn't support new migration style

This reverts commit b7bfdec.
  • Loading branch information
sikachu committed Mar 23, 2012
1 parent b7bfdec commit 19aedbc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions generators/paperclip/templates/paperclip_migration.rb.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
class <%= migration_name %> < ActiveRecord::Migration
def change
def self.up
<% 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
add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_fingerprint, :string, length: 32
<% 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
<% end -%>
end
end

0 comments on commit 19aedbc

Please sign in to comment.