mirror of
https://github.com/kemko/paperclip.git
synced 2026-01-01 16:05:40 +03:00
20 lines
1006 B
Plaintext
20 lines
1006 B
Plaintext
class <%= migration_name %> < ActiveRecord::Migration
|
|
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
|
|
<% 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
|