Sha256: 88e50d00355701b35bed43bf07ae0a92197e801ea9efa8d643777ff76573fa95

Contents?: true

Size: 974 Bytes

Versions: 71

Compression:

Stored size: 974 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def self.up
<% attachment_names.each do |attachment| -%>
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime
<% end -%>
  end

  def self.down
<% attachment_names.each do |attachment| -%>
    remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_name
    remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_content_type
    remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_size
    remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at
<% end -%>
  end
end

Version data entries

71 entries across 71 versions & 23 rubygems

Version Path
paperclip-v2_7-patched-ruby-1_8_6-2.7.5 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.7.5 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.7.4 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.7.2 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.8.0 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.7.1 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-3.0.4 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-3.0.3 lib/generators/paperclip/templates/paperclip_migration.rb.erb
cloudfuji_paperclip-3.0.3 lib/generators/paperclip/templates/paperclip_migration.rb.erb
cloudfuji_paperclip-2.4.6 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-3.0.2 lib/generators/paperclip/templates/paperclip_migration.rb.erb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/paperclip-2.3.16/lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.7.0 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.6.0 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.5.2 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.5.1 lib/generators/paperclip/templates/paperclip_migration.rb.erb
smarter_paperclip-0.3.0 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.5.0 lib/generators/paperclip/templates/paperclip_migration.rb.erb
mender_paperclip-2.4.3.1 lib/generators/paperclip/templates/paperclip_migration.rb.erb
cemeng-paperclip-2.3.6 lib/generators/paperclip/templates/paperclip_migration.rb.erb